HTTP Error 503. The service is unavailable.

Issue:

I’m getting an error 503 when visited a newly created site in IIS with AppPool account. Is it error in my code?

Service Unavailable
HTTP Error 503. The service is unavailable.

Environment:

Windows 2012 R2, IIS 8.5, ASP.Net

Resolution:

This error happened usually is because app pool is down. To start an app pool service, please follow following steps.

Step-by-step instructions:-

  1. Open IIS Manager on your web server
  2. Browse to “Application Pools”
  3. Verify app pool status by checking status column next to app pool name that is being used by the app
  4. Right click on app pool name and select “Start” to start app pool service
  5. Go to web browser and check if the application is up and running

Troubleshoot:

For ASP.Net project, is always good idea to turn off custom error on development server. Do not  turn off custom error on production server to avoid security risk. To turn custom error off, change mode to “Off” on web.config:

<customErrors mode="Off" />

 

ID4291: The security token ‘Microsoft.IdentityModel.Tokens.SessionSecurityToken’ is not scoped to the current endpoint

Issue:

ID4291: The security token ‘Microsoft.IdentityModel.Tokens.SessionSecurityToken’ is not scoped to the current endpoint

Or

ID4291: The security token ‘System.IdentityModel.Tokens.SessionSecurityToken’ is not scoped to the current endpoint

My Web.Config:

  <system.identityModel.services>
    <federationConfiguration>
      <cookieHandler requireSsl="false" path="/" />

Environment:

Windows, ASPNet, IdentityModel, STS

Resolution:

The issue is due to root path error. Please check all apps’ web.config and make sure all web.configs have same path value under identity model section.

Step-by-step instructions:-

  1. Open web.config of an application in edit mode
  2. Search for “cookiehandler”
  3. Remove  path=”/” from cookie handler attribute:
    <cookieHandler requireSsl=”false” />
  4. Save web.config and try again.
      <system.identityModel.services>
        <federationConfiguration>
          <cookieHandler requireSsl="false" />

Reference:

MSDN