"The process cannot access the file" for two AppPools, same directory

100 views
Skip to first unread message

Rich Quackenbush

unread,
May 8, 2013, 11:06:24 AM5/8/13
to cass...@googlegroups.com
I'm getting an exception while trying to serve two instances of an application (each in its own AppPool) that point to the same physical folder.  This happens for every request to the site - I'm testing locally in a controlled dev environment (so it doesn't seem to have anything to do with concurrent requests).

Is there any way to work around this?

Cassette.AspNet version 2.0.0.17975

Exception information: 
    Exception type: IOException 
    Exception message: The process cannot access the file 'script/app/3164853927b89345077b393826e19c6f563e361e.js' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath)
   at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, IsolatedStorageFile isf)
   at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, IsolatedStorageFile isf)
   at System.IO.IsolatedStorage.IsolatedStorageFile.OpenFile(String path, FileMode mode, FileAccess access, FileShare share)
   at Cassette.IO.IsolatedStorageFile.Open(FileMode mode, FileAccess access, FileShare fileShare)
   at Cassette.Caching.BundleCollectionCacheWriter.WriteBundleContentFile(Bundle bundle)
   at Cassette.Caching.BundleCollectionCacheWriter.WriteBundleContentFiles(IEnumerable`1 bundles)
   at Cassette.CacheAwareBundleCollectionInitializer.WriteToCache()
   at Cassette.CacheAwareBundleCollectionInitializer.Initialize(BundleCollection bundleCollection)
   at Cassette.ExceptionCatchingBundleCollectionInitializer.Initialize(BundleCollection bundleCollection)

Andrew Davey

unread,
May 8, 2013, 11:39:19 AM5/8/13
to Cassette
My guess is that both application instances are attempting to build the bundle cache and write it to disk (in this case IsolatedStorage). They are both writing to the same location, which is causing this IO exception.

Do both apps have their own web.configs? If so, it's possible to configure Cassette to use different cache directories.

When building Cassette, I didn't consider this use case. Can anyone suggest a way to write cache files from multiple processes, without conflicts?

Otherwise, I think you'll need to try using Cassette.MSBuild to build the cache directory at compile-time. http://getcassette.net/documentation/v2/msbuild



--
You received this message because you are subscribed to the Google Groups "Cassette" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cassette+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages