0
我最近將一個補丁推送到了一個正在開發我們的開發和測試環境的程序中。測試者登錄並報告此錯誤:Nhibernate爲IIS構建無法訪問的路徑
Access to the path 'C:\Windows\SysWOW64\inetsrv\Mappings' is denied.
有了這個堆棧跟蹤:
[UnauthorizedAccessException: Access to the path 'C:\Windows\SysWOW64\inetsrv\Mappings' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +10797222
System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost) +10589262
System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost) +136
System.IO.Directory.CreateDirectory(String path) +33
DrillingContracts.DataAccess.DefaultSessionFactory.CreateSessionFactory() in c:\TeamCity\buildAgent\work\5bcbb1bc83d7c1a0\Trunk\src\app\DataAccess\DefaultSessionFactory.cs:22
NCommon.Data.NHibernate.NHSessionResolver.RegisterSessionFactoryProvider(Func`1 factoryProvider) +108
NCommon.Data.NHibernate.NHConfiguration.WithSessionFactory(Func`1 factoryProvider) +76
Bootstrapper.Modules.DataAccessModule.<Load>b__1(NHConfiguration c) in c:\TeamCity\buildAgent\work\5bcbb1bc83d7c1a0\Trunk\Bootstrap\Modules\DataAccessModule.cs:29
NCommon.Configuration.NCommonConfig.ConfigureData(Action`1 actions) +94
Bootstrapper.Modules.DataAccessModule.Load(ContainerBuilder builder) in c:\TeamCity\buildAgent\work\5bcbb1bc83d7c1a0\Trunk\Bootstrap\Modules\DataAccessModule.cs:24
Autofac.Module.Configure(IComponentRegistry componentRegistry) +70
Autofac.ContainerBuilder.Build(IComponentRegistry componentRegistry, Boolean excludeDefaultModules) +113
Autofac.ContainerBuilder.Build(ContainerBuildOptions options) +53
Bootstrapper.Bootstrapper.Configure() in c:\TeamCity\buildAgent\work\5bcbb1bc83d7c1a0\Trunk\Bootstrap\Bootstrapper.cs:35
DrillingContracts.IoC.WebBootstrapper.Configure() in c:\TeamCity\buildAgent\work\5bcbb1bc83d7c1a0\Trunk\src\app\DrillingContracts\IoC\WebBootstrapper.cs:25
DrillingContracts.MvcApplication.Bootstrap() in c:\TeamCity\buildAgent\work\5bcbb1bc83d7c1a0\Trunk\src\app\DrillingContracts\Global.asax.cs:34
DrillingContracts.MvcApplication.Application_Start() in c:\TeamCity\buildAgent\work\5bcbb1bc83d7c1a0\Trunk\src\app\DrillingContracts\Global.asax.cs:24
[HttpException (0x80004005): Access to the path 'C:\Windows\SysWOW64\inetsrv\Mappings' is denied.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9860497
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): Access to the path 'C:\Windows\SysWOW64\inetsrv\Mappings' is denied.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9874840
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
我就找到了有問題的代碼。
string SchemaExportPath = Path.Combine(System.Environment.CurrentDirectory, "Mappings");
if (!Directory.Exists(SchemaExportPath))
Directory.CreateDirectory(SchemaExportPath);
我跟蹤了本地路徑,發現它是一個空目錄,這似乎什麼都不做。這讓我非常緊張。
我該如何診斷生產現在在多重版本之後如何/爲何要關注?