Can't share isolated storage file between applications in different app pools

FoadT

New Member
I've got various web apps (containing WCF services) in IIS under the default website. As long as they are all running in the same app pool they can access a shared isolated storage file no problem.However, once I move them to different app pools I get "System.IO.IsolatedStorage.IsolatedStorageException: Unable to create mutex" when one tries to access a file created by another. They are all running under NetworkService user. I tried GetUserStoreForAssembly and GetMachineStoreForAssembly all with the same result. Any ideas why they couldn't use a shared file?I made sure to close the stream and even dispose it in case one was holding onto it, but I am running a simple test where one service writes it, then another tries to read from it later, and it always fails.Also, I am accessing the isolated store from a signed assembly.Does anybody have any ideas?Here is the code:\[code\]Private Sub LoadData() Dim filename = FullFilePath(_fileName) Dim isoStorage As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForAssembly() ' Tried GetMachineStoreForAssembly, same failure isoStorage.CreateDirectory(ROOT_DIRECTORY) If (isoStorage.GetFileNames(filename).Length = 0) Then Return End If Dim stream As Stream = New IsolatedStorageFileStream(filename, FileMode.OpenOrCreate, isoStorage) If stream IsNot Nothing Then Try Dim formatter As IFormatter = New BinaryFormatter() Dim appData As Hashtable = DirectCast(formatter.Deserialize(stream), Hashtable) Dim enumerator As IDictionaryEnumerator = appData.GetEnumerator() While enumerator.MoveNext() Me(enumerator.Key) = enumerator.Value End While Finally stream.Close() stream.Dispose() stream = Nothing End Try End IfEnd SubPublic Sub Save() Dim filename = FullFilePath(_fileName) ' Open the stream from the IsolatedStorage. Dim isoFile As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForAssembly() ' Tried GetMachineStoreForAssembly, same failure Dim stream As Stream = New IsolatedStorageFileStream(filename, FileMode.Create, isoFile) If stream IsNot Nothing Then Try Dim formatter As IFormatter = New BinaryFormatter() formatter.Serialize(stream, DirectCast(Me, Hashtable)) Finally stream.Close() stream.Dispose() stream = Nothing End Try End IfEnd Sub\[/code\]
 
Back
Top