我的global.asax文件中有以下代码(在我的asp.net应用程序中)...
我在堆栈跟踪中有以下错误:
[NullReferenceException: Object reference not set to an instance of an object.]
Digita.Tustena.Global.Application_Start(Object sender, EventArgs e) +133
[HttpException (0x80004005): Object reference not set to an instance of an object.]
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): Object reference not set to an instance of an object.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11524352
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4782309
我的代码有什么问题?我赞美你的帮助...
答案 0 :(得分:2)
查看Global.asax.cs文件中的Application_Start方法。那里有一个空引用。放一个try / catch并使用调试器来查看哪个对象为空。
如果使用dll部署pdb文件,堆栈跟踪也将包含行号。还要将调试信息设置为完整:项目属性 - >构建 - >高级 - >调试信息(http://stackoverflow.com/a/3791997/57369)