App won't run when Combinator is enabled

Feb 1, 2012 at 6:56 PM

Getting this in my error logs. When i try to browse to the app in my web browser I get a .NET "The resource cannot be found" error. 

2012-02-01 18:54:00,172 [5] Orchard.Environment.DefaultOrchardHost - A tenant could not be started: Default
System.UnauthorizedAccessException: Access to the path 'C:\sites\mysite\App_Data\Sites\Default\mappings.bin' is denied.
   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)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at Orchard.FileSystems.AppData.AppDataFolder.CreateFile(String path) in C:\projects\OrchardEnlistments\1.x\src\Orchard\FileSystems\AppData\AppDataFolder.cs:line 122
   at Orchard.Data.SessionConfigurationCache.StoreConfiguration(ConfigurationCache cache) in C:\projects\OrchardEnlistments\1.x\src\Orchard\Data\SessionConfigurationCache.cs:line 73
   at Orchard.Data.SessionConfigurationCache.GetConfiguration(Func`1 builder) in C:\projects\OrchardEnlistments\1.x\src\Orchard\Data\SessionConfigurationCache.cs:line 57
   at Orchard.Data.SessionFactoryHolder.BuildConfiguration() in C:\projects\OrchardEnlistments\1.x\src\Orchard\Data\SessionFactoryHolder.cs:line 93
   at Orchard.Data.SessionFactoryHolder.GetConfiguration() in C:\projects\OrchardEnlistments\1.x\src\Orchard\Data\SessionFactoryHolder.cs:line 71
   at Orchard.Data.SessionFactoryHolder.GetSessionFactory() in C:\projects\OrchardEnlistments\1.x\src\Orchard\Data\SessionFactoryHolder.cs:line 62
   at Orchard.Data.SessionLocator.For(Type entityType) in C:\projects\OrchardEnlistments\1.x\src\Orchard\Data\SessionLocator.cs:line 29
   at Orchard.Data.Repository`1.get_Table() in C:\projects\OrchardEnlistments\1.x\src\Orchard\Data\Repository.cs:line 30
   at Orchard.Data.Repository`1.Fetch(Expression`1 predicate) in C:\projects\OrchardEnlistments\1.x\src\Orchard\Data\Repository.cs:line 126
   at Orchard.Data.Repository`1.Get(Expression`1 predicate) in C:\projects\OrchardEnlistments\1.x\src\Orchard\Data\Repository.cs:line 91
   at Orchard.Core.Settings.Descriptor.ShellDescriptorManager.GetDescriptorRecord() in C:\projects\OrchardEnlistments\1.x\src\Orchard.Web\Core\Settings\Descriptor\ShellDescriptorManager.cs:line 57
   at Orchard.Core.Settings.Descriptor.ShellDescriptorManager.GetShellDescriptor() in C:\projects\OrchardEnlistments\1.x\src\Orchard.Web\Core\Settings\Descriptor\ShellDescriptorManager.cs:line 31
   at Orchard.Environment.ShellBuilders.ShellContextFactory.CreateShellContext(ShellSettings settings) in C:\projects\OrchardEnlistments\1.x\src\Orchard\Environment\ShellBuilders\ShellContextFactory.cs:line 66
   at Orchard.Environment.DefaultOrchardHost.CreateAndActivateShells() in C:\projects\OrchardEnlistments\1.x\src\Orchard\Environment\DefaultOrchardHost.cs:line 135

Feb 1, 2012 at 7:00 PM

I have verified that defaultappPool has full control over the app_Data directory. Tried iisresets, and rehydrating the site. 

Feb 1, 2012 at 7:37 PM

More info: I'm using 1.x branch, latest copy as of today. This may actually be a bug in the orchard code. I'm not sure how to check. 


This works fine using the same exact code and recipe when I run from within visual studio's web server. 

Feb 1, 2012 at 8:07 PM
Edited Feb 1, 2012 at 8:07 PM

The stack trace tells that a Repository call (actually nothing indicates it's Combinator) failed because access was denied to the mappings.bin file, which stores the mappings between records and database tables. I can't add much here - still, the process running the site hasn't got rights to open mappings.bin. It's not surprising this does not happen on localhost: there you're logged in with a user that I guess has access privileges to the files of the Orchard instance and you're running Cassini (the dev server) as that user. Hence my best guess is that, despite you said the application has full control over App_Data, access privileges are erroneously set up on the server.

This is a general Orchard issue, as this will prevent practically anything from running since it effectively prevents database access..

Feb 1, 2012 at 8:39 PM

Well I can get the site working again by disabling Combinator, and I have a handful of other modules working. I think it might be a bug in Orchard that only Combinator is uncovering. I'm positive that the permissions are set up correctly. I've reapplied them both through the windows explorer properties as well as a through a script i normally use. 


Is it possible it's something with tasks? And that the error is related to files being locked rather than actual permissions? I have had problems before where .NET exceptions that looked like permissions issues were actually file locking. I'll post in Orchard discussion board too. 

Feb 1, 2012 at 8:49 PM

Posted on the Orchard board: 

Feb 1, 2012 at 11:22 PM
Edited Feb 1, 2012 at 11:22 PM

Resolved, it was a permissions issue after all. See thread linked in the post above this one for more info.