2012-04-24 21 views
10

RavenDB Embedded'i veri için entegre bir destek deposu olarak kullanan geliştirdiğim bir ASP.Net MVC 3 uygulamasına sahibim, RavenDB Embedded ile bir MVC uygulaması oluşturmaya başlamanız için temel olarak this eğitimini kullandım. Benim geliştirme PC ince çalıştırmak mümkün oldum, ama bu bizim Windows Server 2003 web sunucusu çalıştıran IIS6 üzerinde dağıtmak zamanı geldiğinde aşağıdaki hatayı attı:RavenDB dağıtım sorunu

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.EsentFileAccessDeniedException: 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:

[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:2736 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:\inetpub\wwwroot\MyApp\App_Data\Database\RavenDB\Data]
Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator uuidGenerator) in c:\Builds\RavenDB-Stable\Raven.Storage.Esent\TransactionalStorage.cs:222 Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration configuration) in c:\Builds\RavenDB-Stable\Raven.Database\DocumentDatabase.cs:185
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:496 MyApp.CompositionRoot.CreateControllerFactory() in ...\MyApp\CompositionRoot.cs:36 MyApp.CompositionRoot..ctor() in ..\MyApp\CompositionRoot.cs:17
MyApp.MvcApplication.Application_Start() in ...MyApp\Global.asax.cs:38

[HttpException (0x80004005): Could not open transactional storage: C:\inetpub\wwwroot\MyApp\App_Data\Database\RavenDB\Data]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +3985477
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): Could not open transactional storage: C:\inetpub\wwwroot\MyApp\App_Data\Database\RavenDB\Data]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11524352 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4782309

hatanın kaynağını içinde Başvurulan KompozisyonRoot.cs sınıfı, Gömülü Belge Deposu'nun başlatılmasıdır.

private static IControllerFactory CreateControllerFactory() 
{ 
    var cacheRepository = new EmbeddableDocumentStore(); 
    cacheRepository.ConnectionStringName = "RavenDB"; 

    #if DEBUG 
     cacheRepository.UseEmbeddedHttpServer = true; 
    #endif 

    Raven.Database.Server.NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8080); 
    cacheRepository.Initialize(); //Source of Error 
    var controllerFactory = new TDRControllerFactory(cacheRepository); 
    return controllerFactory; 
} 

Neden bu yalnızca web sunucusunda oluyor ve geliştirme bilgisayarımda değil? Tam olarak neden olabileceğinden emin değilim. Herhangi bir yardım takdir edilir.

+0

, IIS altında çalışan bir klasik izin sorunu gibi görünüyor. RavenDB ile hiçbir tanıdık gelmedi, ancak bunu \ webroot'un dışına taşıyacak ve IIS kullanıcısına bu yoldan ayrıcalıklar verecektim. – kenny

+0

, RavenDB zaten bir hizmet olarak mı yoksa komut satırından mı çalışıyor? – wal

cevap

15

Bu bir izin sorunu olduğu ortaya çıktı, IIS_IUSRS grubunun uygulamamın kök dizininde değişiklik ve yazma izinlerini verdim ve veritabanını düzgün şekilde başlatmak için gereken izinleri verdim. Muhtemelen kökünde kökte değişiklik/yazma erişimi (dosyamda, muhtemelen App_Data klasörü, yani benim RavenDB örneğimi örneklediğim için) gerektiren belirli bir klasör var. Herhangi bir kullanıcının tüm uygulama klasörüne değişiklik/yazma hakları olmasını istemediğim gibi test etmem gerekecek.

4

CreateControllerFactory ürününüzün, uygulama başlangıcındaki eşzamanlı isteklerin karşısında bile yalnızca bir kez çalışacağından emin olmanız gerekir.

+0

Teşekkürler Ayende, hatanın bir izin sorunu olduğu ortaya çıktı. Uygulamamın kök klasörüne IIS_IUSRS grubuna değişiklik ve yazma erişimi verdim ve veritabanının düzgün bir şekilde başlatılmasını sağladım. Sorunun tekrar gündeme gelmesi durumunda cevabınızı da aklımda tutacağım. RavenDB'deki harika işler, bu bizim ilişkisel olmayan bir veritabanına ilk girişimizdir, bu yüzden nasıl çalıştığını görmek için kaygılıyız. – kingrichard2005