错误 FileAccessDenied(JET_errFileAccessDenied,无法访问文件,文件已锁定或正在使用)

发布于 2024-11-07 21:05:07 字数 4743 浏览 1 评论 0原文

我正在尝试将 Raven DB 部署到以集成模式运行 .Net 4 的站点(该站点以前用于托管 ASP.Net MVC 3 站点。

我的配置文件是这样的:

<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>

但是,我得到的异常是这样的:

**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**

我已经联系了我的主机并确认我具有对 App_Data 的读/写访问权限,并且我自己也通过编写一些代码来在那里创建文件来确认这一点,

我的主机暗示我的问题可能是由于双重初始化造成的。我的数据存储-无论这意味着什么。

你们中的任何人都可以在这里指出解决方案吗?

更新 2011-05-18 我正在使用 RavenDB-Build-360,目前可在 http://builds.hibernatingrhinos.com/download/2004< /a> .我正在使用 http://ravendb.net/documentation/docs-deployment-iis< 上的安装说明/a> 用于在 IIS 7.5 上运行它。但我没有使用自己的本地 IIS,而是只是将 /Web 文件夹的内容复制到我的主机。这意味着 /bin 文件夹、web.config 和 SilverLight XAP 文件。所以我无法通过任何方式调试我的方式。

我没有注意到第一行(关于 WebDAV 模块),但我会尽快与我的主机核实。
Raven DB 如何依赖于此?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

花海 2024-11-14 21:05:07

我遇到了完全相同的问题 - 我的解决方案是将默认应用程序池身份从“ApplicationPoolIdentity”删除到管理员帐户(例如我自己用于测试目的)。
重新启动网站后,这就起作用了。

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.

花开柳相依 2024-11-14 21:05:07

我也遇到了这个问题,并且无法使用网上找到的任何解决方案来解决它。

我最终进入 IIS,右键单击使用 raven 的 Web 应用程序,编辑权限。

选择“安全”选项卡,单击“网络服务”,然后选中“完全控制”。点击应用,一切又开始工作了。

底线:结果是权限问题。我不确定为什么我的权限被更改,因为所有这些在几天前都有效。也许是 IIS 补丁?我不知道。无论如何,请确保网络服务拥有使用 raven 的 Web 应用程序的权限。我将完全控制权交给了网络服务,但您可能无法获得读/写控制权。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文