The Mvc 3 application stops randomly (especially after repeated use). IIS 7.5 Integrated Mode

We have an MVC 3 application that runs on IIS 7 and the application pool management pool. Integrated .

This application suddenly becomes unstable, which means an error, as shown below.

Log Name:      Application
Source:        ASP.NET 4.0.30319.0
Date:          04.02.2014 12:01:16
Event ID:      1309
Task Category: Web Event
Level:         Warning
Keywords:      Classic
User:          N/A
Computer:      
Description:
Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 04.02.2014 12:01:16 
Event time (UTC): 04.02.2014 10:01:16 
Event ID: 9896973154a54e5b88e6f1799922e853 
Event sequence: 6 
Event occurrence: 1 
Event detail code: 0 

Application information: 
    Application domain: /LM/W3SVC/3/ROOT-1-130359816693915362 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: D:\WebSites\ 
    Machine name: DC1VMCIFWEB02 

Process information: 
    Process ID: 4152 
    Process name: w3wp.exe 
    Account name: NT AUTHORITY\SYSTEM 

Exception information: 
    Exception type: NullReferenceException 
    Exception message: Object reference not set to an instance of an object.
   at System.Web.PipelineModuleStepContainer.GetEventCount(RequestNotification notification, Boolean isPostEvent)
   at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
   at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
   at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)

This is also our global.asax.cs code, and I was wondering if something was wrong with this code;

public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
            log4net.Config.XmlConfigurator.Configure(); 
        }

        protected void Application_AcquireRequestState(object sender, EventArgs e)
        {
            Response.Cache.SetExpires(DateTime.Now.AddSeconds(0));
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetValidUntilExpires(true);


            if (HttpContext.Current.Session != null)
            {
                CultureInfo ci = (CultureInfo)this.Session["Culture"];
                if (ci == null)
                {
                    string langName = "tr";

                    if (HttpContext.Current.Request.UserLanguages != null && HttpContext.Current.Request.UserLanguages.Length != 0)
                    {
                        langName = HttpContext.Current.Request.UserLanguages[0].Substring(0, 2);
                    }
                    ci = new CultureInfo(langName);
                    this.Session["Culture"] = ci;
                }
                Thread.CurrentThread.CurrentUICulture = ci;
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(ci.Name);
            }
        }

        protected void Application_Error(object sender, EventArgs e)
        {
            Exception ex = Server.GetLastError();

            Application[HttpContext.Current.Request.UserHostAddress.ToString()] = ex;

            Class.LogClass.Error(this.GetType().ToString(), "Application_Error : ", ex);
        }
+3
source share
1 answer

Regarding this line:

Application[HttpContext.Current.Request.UserHostAddress.ToString()] = ex;

Per MSDN :

, . , . - -. , , , , . . ASP.NET ASP.NET.

, , UserHostAddress/Exception object. , IP-, . , , . - , , - , , .

, , , HttpContext.Items, . , .

, , , .

0

All Articles