Global.asax not loading for asp.net precompiled website

I used Visual Studio 2008 to publish my asp.net site. When I open the site on the server (Windows 2008 server), I noticed that the code in global.asax is not running. The body of My Global.asax is like:

<%@ 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 file called App_global.asax.dll in the compiled websites folder, but that doesn't seem to help.

Is there a configuration option that I am missing? Removing App_global.asax.dll and using the global.asax source file with a pre-compiled site work fine.

+5
source share
6 answers

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

+5

, PrecompiledApp.config - .

, Visual Studio.

+4

, , . , .

+1

, DLL , , , , dlls, , , , Dlls.

.

+1

I had a similar problem after publishing a precompiled ASP.NET project under .NET 4 and IIS 7.0. The global application did not start when the application started, and then after placing PrecompiledApp.config on the server, my problem was resolved and the Global.asax file was compiled with the name App_global.asax.dll, which came to the forefront of the life cycle and works.

+1
source

I think renaming Application_Start () to Application_OnStart () will solve the problem.

0
source

All Articles