2012-03-29 5 views
4

これは私の人生を完全に痛ましいものにしています..変更された内容は正しくは分かりませんが、データベースはMVC3サイトのApp_Dataフォルダにあります。このWebサイトは、既定のWebサイトとして適切なIIS 7.5でホストされています。RavenDb、ファイルにアクセスできない、ファイルがロックされている、または使用中です

解決のヒントをお待ちしております。

EDIT ..問題は、例外は、このように文書セッション

Line 30:    instance = new EmbeddableDocumentStore { ConnectionStringName = "RavenDB" }; 
Line 31:    instance.Conventions.IdentityPartsSeparator = "-"; 
Line 32:    instance.Initialize(); 

[EsentFileAccessDeniedException: Cannot access file, the file is locked or in use] 
    Microsoft.Isam.Esent.Interop.Api.Check(Int32 err) in C:\Work\ravendb\SharedLibs\Sources\managedesent-61618\EsentInterop\Api.cs:2739 
    Microsoft.Isam.Esent.Interop.Api.JetInit(JET_INSTANCE& instance) in C:\Work\ravendb\SharedLibs\Sources\managedesent-61618\EsentInterop\Api.cs:131 
    Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator uuidGenerator) in c:\Builds\RavenDB-Stable\Raven.Storage.Esent\TransactionalStorage.cs:207 

[InvalidOperationException: Could not open transactional storage: C:\code\BE\Com.BuyEfficient\Com.BuyEfficient.Web\App_Data\ravendata\Data] 
    Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator uuidGenerator) in c:\Builds\RavenDB-Stable\Raven.Storage.Esent\TransactionalStorage.cs:220 
    Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration configuration) in c:\Builds\RavenDB-Stable\Raven.Database\DocumentDatabase.cs:156 
    Raven.Client.Embedded.EmbeddableDocumentStore.InitializeInternal() in c:\Builds\RavenDB-Stable\Raven.Client.Embedded\EmbeddableDocumentStore.cs:143 
    Raven.Client.Document.DocumentStore.Initialize() in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\DocumentStore.cs:483 
    Com.BuyEfficient.Web.Infrastructure.DataDocumentStore.Initialize() in C:\code\BE\Com.BuyEfficient\Com.BuyEfficient.Web\Infrastructure\DataDocumentStore.cs:32 
    Com.BuyEfficient.Web.App_Start.Services.PreStart() in C:\code\BE\Com.BuyEfficient\Com.BuyEfficient.Web\App_Start\Services.cs:25 

[TargetInvocationException: Exception has been thrown by the target of an invocation.] 
    System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0 
    System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72 
    System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +335 
    System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28 
    System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19 
    WebActivator.BaseActivationMethodAttribute.InvokeMethod() +221 
    WebActivator.ActivationManager.RunActivationMethods() +491 
    WebActivator.ActivationManager.RunPreStartMethods() +28 
    WebActivator.ActivationManager.Run() +55 

[InvalidOperationException: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation..] 
    System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +423 
    System.Web.Compilation.BuildManager.CallPreStartInitMethods() +306 
    System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +677 

[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation..] 
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9090044 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97 
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256 

答えて

4

シュパーテンにdisposeの呼び出しではない、スローされた後にクリーンアップしない、おそらく私のコントローラのコードに多かれ少なかれ関連している、あなたが作る必要がありますDocumentStoreおよびDocumentSessionライフサイクル管理を適切に処理することを確認してください。アプリケーションの開始時にDocumentStoreをシングルトンとして作成し、開始要求と終了要求でセッションを開き、処分する必要があります。私はOnBeginRequestとOnEndRequestのための独自のハンドラを書くことをお勧めします。

公式サンプルアプリケーションRaccoonBlogをご覧ください。

+0

+1サンプルアプリへのリンク:) –

関連する問題