【发布时间】:2015-03-07 08:30:17
【问题描述】:
由于文件夹删除,我在重新启动应用程序池时遇到了一些问题,所以我想我会尝试禁用 fcnMode(此处描述:Application Restart for folder deleted,added,updated)。
我尝试使用注册表,并将其设置为 1。网络应用程序将不再启动...我也尝试了 2,网络启动但文件夹删除问题仍然存在。 2 没有禁用 FCN,所以我猜这是意料之中的。
然后我尝试在 web.config 中使用 .NET 4.5 新的 fcnMode 值:
这与将注册表项设置为 1 具有完全相同的效果。
在这里你可以看到我遇到的问题。
Server Error in '/' Application.
Object reference not set to an instance of an object.
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: System.NullReferenceException: Object reference not set to an instance of an object.
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:
[NullReferenceException: Object reference not set to an instance of an object.]
System.Object.GetType() +0
<Secret.NameSpace>.OieApplication.Application_Start(Object sender, EventArgs e) +289
[HttpException (0x80004005): Object reference not set to an instance of an object.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12600317
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475
[HttpException (0x80004005): Object reference not set to an instance of an object.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12617364
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12456981
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212
【问题讨论】:
-
您可以启用调试以获得更好的堆栈跟踪吗?
<Secret.NameSpace>.OieApplication.Application_Start +289告诉我们它在你的代码中,但不是在哪里。 -
我已经在调试模式下运行它了。该错误甚至不会触发 Visual Studio 中的错误 - 它只是在 IIS Express 中崩溃。我猜 +289 不是行号而是一些调试信息?
-
customErrors在 Web.config 中设置为什么? -
-
您也有retail=false,并且Visual Studio 正在生成带有关联的.pdb 文件的调试模式程序集?奇怪的。你能创建一个重现项目吗?