Sandy Sandy - 1 month ago 12
C# Question

HTTP Error 503. The service is unavailable. App pool stops on accessing website

There are number of posts on this and I have tried many a things by now. But to no avail. Myself a Winforms Developer basically, started working on this Web stuff few days back as my company is taking Web initiatives.

I have a ASP.Net project and I want to host it on local IIS. In

Project properties -> Web
settings I chose
Use Local IIS Server
and gave a url as
localhost/MyApp
. I tried accessing it on my firefox browser and received error as
HTTP Error 503. The service is unavailable.


Previously I got many other errors and I one by one fixed them all. But struck with this one. These are the settings I have in my project


  1. Application Pool set to ASP.Net v4.0 Classic

  2. App Pool
    Enable 32 bit Application
    property is true

  3. App Pool is started

  4. Project build property set to
    Any CPU
    for Target framework



But I would like to mention a weird behavior. Following is something that I am facing


  1. Application Pool is Started

  2. I try to access my local website (by giving url as
    localhost/MyApp
    )

  3. I receive the error as
    HTTP Error 503. The service is unavailable

  4. Application Pool is Stopped



I have seen following link and I have already tried it. For the above behavior I reached here. According to this link, Computer name should not have
.
in it. I don't have any
.
in my Computer name but do have
-
in it. Also my domain name contains
.
in it. Moreover I can't change these settings as its my office laptop and our TFS settings are bound to our Domain and Computer Names.

Can anyone help me to understand whats happening? Please guide me. Thanks.

Edit

I have following code in
Global.asax
.
Application_BeginRequest
method is empty in same file.

protected override void Application_Start(object sender, EventArgs e)
{
base.Application_Start(sender, e);
String _path = String.Concat(System.AppDomain.CurrentDomain.RelativeSearchPath, ";",
System.Environment.GetEnvironmentVariable("PATH"));
System.Environment.SetEnvironmentVariable("PATH", _path, EnvironmentVariableTarget.Process);
MyAppLog.Initialize();
MyAppLog.WriteMessage("Application Started");
}


Update

As per the suggestions in Comment, I am able to run the website from Cassini.

Answer

One possible reason this might happen is that the Application Pool in IIS is configured to run under some custom account and this account either doesn't exist or a wrong password has been provided. Look at the advanced properties of the Application Pool in IIS for which account it uses.

Also the Event Log might contain more information as to why the Application Pool is stopping immediately on the first request.