mjyazdani
mjyazdani

Reputation: 2035

Syntax error in global.asax

I have the code below in my global.asax file (in my asp.net application) ...

enter image description here

and I have the error below in stack trace:

[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

What is the problem with my code? I appriciate your helps ...

Upvotes: 1

Views: 4333

Answers (1)

Gabriel
Gabriel

Reputation: 1652

Look in the method Application_Start in the file Global.asax.cs. You have a null reference there. Put a try/catch and use the debugger to see which object is null.

If you deploy the pdb files with your dll the stack trace will also contain the line number. Also do set the Debug Info to full: Project Properties -> Build -> Advanced -> Debug Info (http://stackoverflow.com/a/3791997/57369)

Upvotes: 2

Related Questions