开发者

Error FileAccessDenied (JET_errFileAccessDenied, Cannot access file, the file is locked or in use)

开发者 https://www.devze.com 2023-03-06 16:21 出处:网络
I am trying to deploy Raven DB to my site running .Net 4 in integrated mode (site was previously used to host ASP.Net MVC 3 site.

I am trying to deploy Raven DB to my site running .Net 4 in integrated mode (site was previously used to host ASP.Net MVC 3 site.

My configuration file is this:

<appSettings>
    <add key="Raven/DataDir" value="~\App_Data"/>
    <add key="Raven/AnonymousAccess" value="All"/>
  <add key="Raven/Port" value="80"/>
</appSettings>
<system.webServer>
    <handlers>
        <add name="All" path="*" verb="*"
                type="Raven.Web.ForwardToRavenRespondersFactory, Raven.Web"/>
    </handlers>
</system.webServer>

However, the exception I get is this:

**Error FileAccessDenied (JET_errFileAccessDenied, Cannot access file, the file is locked or in use)

Description: An 开发者_如何转开发unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Microsoft.Isam.Esent.Interop.EsentErrorException: Error FileAccessDenied (JET_errFileAccessDenied, Cannot access file, the file is locked or in use)

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[EsentErrorException: Error FileAccessDenied (JET_errFileAccessDenied, Cannot access file, the file is locked or in use)]
   Microsoft.Isam.Esent.Interop.Api.Fail(Int32 err) in C:\Work\ravendb\SharedLibs\Sources\ManagedEsent-48322\EsentInterop\Api.cs:2279
   Microsoft.Isam.Esent.Interop.Api.JetInit(JET_INSTANCE& instance) in C:\Work\ravendb\SharedLibs\Sources\ManagedEsent-48322\EsentInterop\Api.cs:130
   Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator uuidGenerator) in c:\Builds\raven\Raven.Storage.Esent\TransactionalStorage.cs:169

[InvalidOperationException: Could not open transactional storage: d:\IIS\domainfolder\ravendb\App_Data\Data]
   Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator uuidGenerator) in c:\Builds\raven\Raven.Storage.Esent\TransactionalStorage.cs:182
   Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration configuration) in c:\Builds\raven\Raven.Database\DocumentDatabase.cs:127
   Raven.Web.ForwardToRavenRespondersFactory..cctor() in c:\Builds\raven\Raven.Web\ForwardToRavenRespondersFactory.cs:31

[TypeInitializationException: The type initializer for 'Raven.Web.ForwardToRavenRespondersFactory' threw an exception.]
   Raven.Web.ForwardToRavenRespondersFactory..ctor() +0

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +69
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1136
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +23
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60
   System.Web.Configuration.HandlerFactoryCache..ctor(String type) +46
   System.Web.HttpApplication.GetFactory(String type) +81
   System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +223
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184**

I have contacted my host and have confirmation that I have read/write access to App_Data and I have also confirmed this myself by writing some code to create a file there.

My host hinted that my problem might be due to double initialisation of my datastore - whatever that means.

Can any of you point me towards a solution here?

UPDATE 2011-05-18 I am using RavenDB-Build-360 currently available at http://builds.hibernatingrhinos.com/download/2004 . I am using the installation instructions on http://ravendb.net/documentation/docs-deployment-iis for running it on IIS 7.5. But instead of using own local IIS, I am simply copying the content of the /Web-folder to my host . This means the /bin-folder, the web.config and the SilverLight XAP-file. So I am not able to debug my way through anything.

I have not noticed the first line (about WebDAV module) but I will check with my host ASAP.

How does Raven DB rely on this?


i had this exact same problem - my solution was to remove the default App Pool identity from 'ApplicationPoolIdentity' to an administrator account (such as myself for testing purposes). after a restart of the web site, this then worked.


I also ran into this problem and was unable to fix it with any of the solutions found on the web.

I ended up going into IIS, right-clicking my web app that uses raven, edit permissions.

Selected the Security tab, clicked NETWORK Service, then checked Full Control. Hit apply, everything started working again.

Bottom line: it turned out to be a permissions issue. I'm unsure why my permissions were changed, as all this was working a few days ago. Perhaps an IIS patch? I don't know. Whatever the case, make sure the Network Service has permission for your web app that uses raven. I gave full control to the Network Service, but you may get away with read/write control.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号