为什么触发带有事件消息“发生未处理的异常”的“事件代码3005”?

时间:2019-02-13 14:52:30

标签: c# asp.net

看起来每天记录一次此错误。

这是我从客户端获得的日志记录:

事件代码:3005 事件消息:发生未处理的异常。 活动时间:11-2-2019 09:38:55 活动时间(UTC):11-2-2019 08:38:55 事件ID:e1bc004346904125a244dbbc5f960710 事件顺序:2024 事件发生:1 事件详细代码:0

申请信息:     应用程序域:/ LM / W3SVC / 2 / ROOT-1-131943410407985469     信任等级:完整     应用程序虚拟路径:/     应用程序路径:C:\ inetpub \ wwwroot ... \     机器名称:PRO01

过程信息:     流程编号:540     进程名称:w3wp.exe     帐户名称:IIS APPPOOL ...

异常信息:     异常类型:NullReferenceException     异常消息:对象引用未设置为对象的实例。    在Davanti.WMS.RF.Common.SiteMaster.OnInit(EventArgs e)    在System.Web.UI.Control.InitRecursive(控件namingContainer)    在System.Web.UI.Control.InitRecursive(控件namingContainer)    在System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)

请求信息:     要求网址:https://...:8080/Pages/Authentication/Login.aspx     请求路径:/Pages/Authentication/Login.aspx     用户主机地址:     用户:
    已验证:错误     身份验证类型:
    线程帐户名称:IIS APPPOOL ...

线程信息:     线程ID:18     线程帐户名称:IIS APPPOOL \     正在冒充:错误     堆栈跟踪:位于... WMS.RF.Common.SiteMaster.OnInit(EventArgs e)    在System.Web.UI.Control.InitRecursive(控件namingContainer)    在System.Web.UI.Control.InitRecursive(控件namingContainer)    在System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)

因此,进入SiteMaster.cs,我看到了。事实是我对此没有任何问题。你能帮我发现它吗?

 public partial class SiteMaster : System.Web.UI.MasterPage
{
    private readonly string WT4100 = "WT4100";
    private readonly string MC9200 = "MC9200";

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        if (!Page.Request.Path.EndsWith("/Login.aspx") && Session.IsNewSession)
        {
            Response.Redirect("~/Pages/Authentication/Login.aspx");
        }

        Page.ClientScript.RegisterStartupScript(this.GetType(), "InitializeEventHandlers", "focusController.initializeFocusController(false);", true);
        Page.ClientScript.RegisterStartupScript(this.GetType(), "InitializeCustomScrollbar", "toggleScrollBarVisibility();", true);
        Page.ClientScript.RegisterStartupScript(this.GetType(), "InitializeWindowResize", "handleResizeEvent();", true);

        // a special stylesheet needs to be used for landscape device
        if (Request != null && !string.IsNullOrEmpty(Request.UserAgent))
        {
            if (Request.UserAgent.Contains(WT4100))
            {
                IsWT41NO.Value = true.ToString();
            }
            else if (Request.UserAgent.Contains(MC9200))
            {
                IsMC92NO.Value = true.ToString();
            }
        }

        LiteralControl mainCssStyleSheet = new LiteralControl();            

        if (Request.ServerVariables["HTTP_USER_AGENT"].ToLower().Contains("android"))
        {
            mainCssStyleSheet.Text = "<link href=\"../../Styles/Common/Android/Site.css\" rel=\"stylesheet\" type=\"text/css\">";
        }
        else
        {
            mainCssStyleSheet.Text = "<link href=\"../../Styles/Common/Site.css\" rel=\"stylesheet\" type=\"text/css\">";
        }

        MainCssPlaceHolder.Controls.Add(mainCssStyleSheet);

        LiteralControl specialDeviceCssStyleSheet = new LiteralControl();

        if (IsWT41NODevice)
        {
            specialDeviceCssStyleSheet.Text = "<link href=\"../../Styles/Common/WT41NO/Site.css\" rel=\"stylesheet\" type=\"text/css\">";
        }
        else if (IsMC92NODevice)
        {
            specialDeviceCssStyleSheet.Text = "<link href=\"../../Styles/Common/Site_MC92NO.css\" rel=\"stylesheet\" type=\"text/css\">";
        }

        MainCssPlaceHolder.Controls.Add(specialDeviceCssStyleSheet);

        using (Session session = new Session())
        {
            string javaScriptCoraxRFSystemSetting = WMSSystemSetting.Get_JavaScriptCoraxRF(session);

            if (!string.IsNullOrWhiteSpace(javaScriptCoraxRFSystemSetting))
            {
                LiteralControl javaScriptCoraxRF = new LiteralControl();
                javaScriptCoraxRF.Text = string.Format("<script type=\"text/javascript\" src=\"{0}\"></script>", javaScriptCoraxRFSystemSetting);
                BottomPageContent.Controls.Add(javaScriptCoraxRF);
            }

            RfLayoutOption rfLayoutOption = RfLayoutOption.Default;

            if (!PageHelper.IsSessionVariableSet(SessionConstants.SiteStyle))
            {
                rfLayoutOption = WMSSystemSetting.Get_RfLayout(session);
                Session[SessionConstants.SiteStyle] = rfLayoutOption;
            }
            else
            {
                rfLayoutOption = (RfLayoutOption)Enum.Parse(typeof(RfLayoutOption), Session[SessionConstants.SiteStyle].ToString());
            }

            AddStyleAccordingToRfLayout(rfLayoutOption);
        }


        if (!this.DesignMode && !IsPostBack)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "FocusFirstInput", "focusController.focusFirstControl();", true);

            // disable client-side caching, so that the user is redirected to the loginpage 
            // when clicking browser back button after logout                
            Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
            Response.Cache.SetValidUntilExpires(false);
            Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetNoStore();

            if (!Page.Request.Path.EndsWith("/Login.aspx") && !SecuritySystem.Instance.IsAuthenticated)
            {
                Response.Redirect("~/Pages/Authentication/Login.aspx");
            }
            if (Page.Request.Path.EndsWith("/Login.aspx"))
            {
                AIC.Text = "version " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
            }
        }
    } ...

0 个答案:

没有答案