嗨,我必须在隔离空间中存储一些隐藏信息。为此,我使用 System.IO.Isolated 类,例如
IsolatedStorageFile isf = System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null);
Stream writer = new IsolatedStorageFileStream(filename, FileMode.Create, isf);
IFormatter formatter = new BinaryFormatter();
formatter.Serialize(writer, appCollection.ToString());
writer.Close();
它在 Windows XP 中工作正常,但在 Windows 2003 生产服务器上显示异常
System.IO.IsolatedStorage.IsolatedStorageException:无法创建存储目录。
我在我的 asp.net 项目文件夹中拥有“Everyone”完全控制权限。注意 CSoft.Core 是我创建的个人框架。
这是我的堆栈跟踪:
[IsolatedStorageException:无法创建存储目录。
(HRESULT 异常:0x80131468)]
System.IO.IsolatedStorage.IsolatedStorageFile.nGetRootDir(IsolatedStorageScope
范围)+0
System.IO.IsolatedStorage.IsolatedStorageFile.InitGlobalsNonRoamingUser(IsolatedStorageScope
范围)+97
System.IO.IsolatedStorage.IsolatedStorageFile.GetRootDir(IsolatedStorageScope
范围)+137
System.IO.IsolatedStorage.IsolatedStorageFile.GetGlobalFileIOPerm(IsolatedStorageScope
范围)+213
System.IO.IsolatedStorage.IsolatedStorageFile.Init(IsolatedStorageScope
范围)+56
System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope
范围、类型domainEvidenceType、类型 assemblyEvidenceType) +59
CSoft.Core.IO.StorageHelper.Save(String fileName, String content) 中
c:\Projectos\FrameworkCS\CSoft.Core\IO\StorageHelper.cs:18
CSoft.Web.UI.ViewStateHelper.SerializeViewState(HttpContext 上下文,
对象状态)中
c:\Projectos\FrameworkCS\CSoft.Web.Controls\Web\UI\ViewStateHelper.cs:65
CSoft.Web.UI.Page.SavePageStateToPersistenceMedium(对象状态) 中
c:\Projectos\FrameworkCS\CSoft.Web.Controls\Web\UI\Page.cs:302
System.Web.UI.Page.SaveAllState() +236
System.Web.UI.Page.ProcessRequestMain(布尔值
includeStagesBeforeAsyncPoint、布尔值 includeStagesAfterAsyncPoint)
+1099
如果它在 IIS 上运行并且应用程序池标识是 NetworkService,您可以尝试转到应用程序池的高级设置并将“加载用户配置文件”值设置为“True”。为我工作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)