Question

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.

Was it helpful?

Solution

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

OTHER TIPS

I had a similar problem and managed to resolve it by removing the PrecompiledApp.config file from the website's root folder on our development server.

I think that this may have been transferred to the server when publishing from Visual Studio.

There are some solutions in this post which fixes the problem for some people, but not all. You could try them and see if it works for you.

Make sure that you have all necessaries dlls included in your project, it's also a good idea, to compile your projects, compare dlls versions, and if these doesn't match, manually replace them into each folder, so you can be sure that your are running the right Dlls version.

This worked for me.

I had the similar problem after publishing precompiled ASP.NET project under .NET 4 and IIS 7.0. Global application was not running at application start, then after placing PrecompiledApp.config to the server my problem was solved and compiled Global.asax file named App_global.asax.dll came to the front of life cycle and running.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top