Application_Start isn't executed

Discussion in 'ASP .Net' started by Peter Morris, Jan 5, 2009.

  1. Peter Morris

    Peter Morris Guest

    I am developing a simple website (merely hosts a silverlight client). The
    site needs to perform some initialisation so I have some code in
    Global.ASAX's Application_Start method, but when I run my website this
    method is never executed. I am using the development server, not IIS. I
    have stopped it, restarted VS, run it again and still no joy.

    Does anyone have any ideas why this might be the case? It is preventing a
    number of critical services from being registered.


    Regards

    Pete



    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.SessionState;

    namespace Server.Web
    {
    public class Global : System.Web.HttpApplication
    {
    private ServerModuleBootstrapper theApplicationBootstrapper = null;

    protected void Application_Start(object sender, EventArgs e)
    {
    theApplicationBootstrapper =
    ServiceContainerHolder.Container.Resolve<ServerModuleBootstrapper>();
    theApplicationBootstrapper.LoadServerModules(
    Server.MapPath("~/Modules"));
    }

    protected void Session_Start(object sender, EventArgs e)
    {

    }

    protected void Application_BeginRequest(object sender, EventArgs e)
    {

    }

    protected void Application_AuthenticateRequest(object sender,
    EventArgs e)
    {

    }

    protected void Application_Error(object sender, EventArgs e)
    {

    }

    protected void Session_End(object sender, EventArgs e)
    {

    }

    protected void Application_End(object sender, EventArgs e)
    {

    }
    }
    }
     
    Peter Morris, Jan 5, 2009
    #1
    1. Advertising

  2. Peter Morris

    Steve S Guest

    Hi Peter,
    I've read about a similar issue, I think they ended up renaming the
    global.asax, adding a new global.asax and then moving the code over to the
    new global.asax, which surprisingly fixed the problem.
    Cheers
    SteveS

    "Peter Morris" <> wrote in message
    news:%...
    >I am developing a simple website (merely hosts a silverlight client). The
    >site needs to perform some initialisation so I have some code in
    >Global.ASAX's Application_Start method, but when I run my website this
    >method is never executed. I am using the development server, not IIS. I
    >have stopped it, restarted VS, run it again and still no joy.
    >
    > Does anyone have any ideas why this might be the case? It is preventing a
    > number of critical services from being registered.
    >
    >
    > Regards
    >
    > Pete
    >
    >
    >
    > using System;
    > using System.Collections.Generic;
    > using System.Linq;
    > using System.Web;
    > using System.Web.Security;
    > using System.Web.SessionState;
    >
    > namespace Server.Web
    > {
    > public class Global : System.Web.HttpApplication
    > {
    > private ServerModuleBootstrapper theApplicationBootstrapper = null;
    >
    > protected void Application_Start(object sender, EventArgs e)
    > {
    > theApplicationBootstrapper =
    >
    > ServiceContainerHolder.Container.Resolve<ServerModuleBootstrapper>();
    > theApplicationBootstrapper.LoadServerModules(
    > Server.MapPath("~/Modules"));
    > }
    >
    > protected void Session_Start(object sender, EventArgs e)
    > {
    >
    > }
    >
    > protected void Application_BeginRequest(object sender, EventArgs e)
    > {
    >
    > }
    >
    > protected void Application_AuthenticateRequest(object sender,
    > EventArgs e)
    > {
    >
    > }
    >
    > protected void Application_Error(object sender, EventArgs e)
    > {
    >
    > }
    >
    > protected void Session_End(object sender, EventArgs e)
    > {
    >
    > }
    >
    > protected void Application_End(object sender, EventArgs e)
    > {
    >
    > }
    > }
    > }
     
    Steve S, Jan 5, 2009
    #2
    1. Advertising

  3. Peter Morris

    Peter Morris Guest

    Thanks Steve

    It still seems intermittent. I've created a static class with the init code
    I need in its static constructor, so when the stuff I need is first
    referenced it will be created. Very dodgy though.



    --
    Pete
    ====
    http://mrpmorris.blogspot.com
    http://www.capableobjects.com - Think domain, not database
     
    Peter Morris, Jan 6, 2009
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Adrian

    Application_Start not firing at all

    Adrian, Jul 2, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    470
    Adrian
    Jul 2, 2003
  2. Halcyon Woodward
    Replies:
    3
    Views:
    1,031
    Halcyon Woodward
    Jul 16, 2003
  3. Leonardo Gangemi

    Creating diretories on Application_Start

    Leonardo Gangemi, Aug 14, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    346
    Kevin Spencer
    Aug 14, 2003
  4. Max
    Replies:
    5
    Views:
    21,174
    liliancho
    Dec 7, 2011
  5. Fred
    Replies:
    5
    Views:
    444
    Eric Sosman
    Oct 6, 2011
Loading...

Share This Page