Вопрос по c#, visual-studio, asp.net – IsolatedStorageException: невозможно создать каталог магазина

4

Error: User Rate Limit Exceeded

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();

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

[IsolatedStorageException: Unable to create the store directory. (Exception from HRESULT: 0x80131468)]
System.IO.IsolatedStorage.IsolatedStorageFile.nGetRootDir(IsolatedStorageScope scope) +0
System.IO.IsolatedStorage.IsolatedStorageFile.InitGlobalsNonRoamingUser(IsolatedStorageScope scope) +97
System.IO.IsolatedStorage.IsolatedStorageFile.GetRootDir(IsolatedStorageScope scope) +137
System.IO.IsolatedStorage.IsolatedStorageFile.GetGlobalFileIOPerm(IsolatedStorageScope scope) +213
System.IO.IsolatedStorage.IsolatedStorageFile.Init(IsolatedStorageScope scope) +56
System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType) +59
CSoft.Core.IO.StorageHelper.Save(String fileName, String content) in c:\Projectos\FrameworkCS\CSoft.Core\IO\StorageHelper.cs:18
CSoft.Web.UI.ViewStateHelper.SerializeViewState(HttpContext context, Object state) in c:\Projectos\FrameworkCS\CSoft.Web.Controls\Web\UI\ViewStateHelper.cs:65 CSoft.Web.UI.Page.SavePageStateToPersistenceMedium(Object state) in c:\Projectos\FrameworkCS\CSoft.Web.Controls\Web\UI\Page.cs:302
System.Web.UI.Page.SaveAllState() +236
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1099

Error: User Rate Limit Exceeded John Saunders

Ваш Ответ

5   ответов
3

using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetMachineStoreForAssembly()) { }

0

0

IsolatedStorageException can be thrown by both GetStore and the IsolatedStorageFileStream constructor "It works fine in Windows XP" - when you run the site in the Visual Studio built in web server running under your (probably admin) credentials, but certainly as a User with a profile, and therefore an Isolated Storage folder. "But on production it throws an exception" - when it's running under either "Network Service" or some other account that doesn't have a profile, or Interact with Desktop type rights (not sure of the specifics - it's mainly the lack of a profile that's a killer).

7

use GetMachineStoreForAssembly

If you must use GetUserStoreForAssembly set the App to run as user with rights. This is not solved by folder permissions. There are several ways to get security setup.(IIS7) You can set it on the App pool, or under basic settings > Connect As, or under Authenication > Anonymous Authenication. I am not sure exactly what rights the user needs, but this will get you going in the right direction.

   Dim storageFile As IsolatedStorageFile
    If Request("storage") = "user" Then
        storageFile = IsolatedStorageFile.GetUserStoreForAssembly()
    Else
        storageFile = IsolatedStorageFile.GetMachineStoreForAssembly()
    End If

    Response.Write(storageFile.GetType.GetField("m_RootDir", Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance).GetValue(storageFile).ToString())

Error: User Rate Limit Exceeded
7

Error: User Rate Limit Exceeded

Похожие вопросы