Application_error event not firing after publishing

Discussion in '.NET' started by KhD, Jul 21, 2011.

  1. KhD


    Jul 21, 2011
    Likes Received:
    I know this has been asked a lot of times, but I could not get things working from those posts.

    I have implemented Application_error method in Global.asax file to log and send email for all unhandled exceptions. This works perfectly fine when running on Visual Studio, but as soon as I publish it to the test server, the Application_event stops firing. No log entry is made to the text file and no email is sent.

    PrecompiledApp.config file is present in the root directory, along with App_global.asax.compiled, App_global.asax.dll in the bin folder. Global.asax file is not present after I publish the website.

    I have tried removing PrecompiledApp.config file, but it doesn't work. I have tried adding Global.asax file to the root directory, but doesn't work. I have tried with

    Code (Text):
    <customErrors mode="Off"  />

    Code (Text):
    <customErrors mode="On" defaultRedirect="Error Page.aspx" />
    in web.config file....nothing works.

    I added a line to Page_load of a page:

    Code (Text):
    Response.Write("<br/>ApplicationInstance: " +  Context.ApplicationInstance.GetType().FullName);
    It returns ApplicationInstance: ASP.global_asax, which should be returned according to a post. Then why is the event not firing?

    Please Help!!!

    KhD, Jul 21, 2011
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.