Global.asax not loading for precompiled asp.net website

Jim Geurts picture Jim Geurts · Oct 27, 2009 · Viewed 10.9k times · Source

I used Visual Studio 2008 to publish my asp.net website. When I bring up the website on the server (Windows 2008 server), I noticed that the code in global.asax was not running. My Global.asax body is similar to:

<%@ Application Language="C#" %>
<script runat="server">
    protected void Application_Start()
    {
        // Initialize some site settings like a task scheduler
    }

    protected void Application_End(object sender, EventArgs e)
    {
        // Perform some clean up code
    }
</script>

There is a App_global.asax.dll in the compiled websites bin folder, but that does not seem to help.

Is there a configuration option that I'm missing? Removing the App_global.asax.dll and using the original global.asax with the precompiled website works fine.

Answer

Jim Geurts picture Jim Geurts · Nov 19, 2009

The only answer I've found is to include global.asax (with logic) in the compiled output folder.