ChatGPT解决这个技术问题 Extra ChatGPT

HTTP Error 503, the service is unavailable

I'm really new to setting up web servers in general. I've got IIS 8 on Windows 8, and I'm trying to set up a little site locally, while doing some development. In IIS I choose Add Site, give a name, points to a location where I have a index.html file (I've tried different locations, latest in a c:\inetpub\wwwroot\test -folder) and otherwise use all default settings. However, when I try to browse to localhost I get

HTTP Error 503. The service is unavailable.

I've verified the pool is started, and I've given IIS_IUSRS Full Control on the target folder

I've search around but not found anything that solved my issue, and there's nothing helpfull in the EventLog or in the C:\Windows\System32\LogFiles\HTTPERR folder

Could anyone tell me what's wrong?

Have you checked event viewer for more info?
A usefull check list (even though it's IIS7) here blogs.msdn.com/b/webtopics/archive/2010/02/17/… - i suspect you have already done these checks, but may help
Reason 1: The HTTP Error 503. The service is unavailable occurs if the Application Pool of the corresponding Wep Application is Stopped or Disabled or Paused. or The given user Identity of Application Pool may be invalid due to expired password or locked. See this perfect fix: morgantechspace.com/2013/12/…
The usual situation for me when ALL logs are EMPTY but still 503. Reasons: 1. Port conflict is the most often one. 2. URL ACL and solution described lower.

B
Broots Waymb

It could be that the user identity is outdated, especially if you've tried starting a stopped app pool and the next request again fails.

In IIS, go to the Application Pools under the Server, then find the correct Application Pool for your web site, and click on it. On the Advanced Settings menu to the right, select Identity and change it and enter new user and password. Click on your Application Pool again, and select Recycle to restart it.

You can also try looking at the error message in Event Viewer, under Windows Logs, Application, Details tab.


This is exactly what happened to me when I changed the password of the identity that was used for W3C worker process. Thanks
I just changed my user password, and the next day (after a restart) it was failing because of a bad password. I need a list of things to change when I change my password!
I went to the Application Pools and realized that somehow my site had been stopped. I restarted it and poof, working good as new.
I had the same issue. Anytime an issue like this happens the Event Viewer is where you should look first. The fist log to check is almost always: Windows Logs -> System. The error message will be something like "Application pool Foo has been disabled. Windows Process Activation Service (WAS) encountered a failure when it started a worker process to serve the application pool." If it is a bad username or password in the identity, then that will be mentioned in a preceding warning log.
I have problem is that AppPool stopped. i just restarted and fixed.
S
Simon Mourier

Other answers are fine. But in my case, I was working on a Windows box that already was running some old IIS, IISExpress or any other web site. What happened is urls ACLs where reserved somehow in the system. So, you might want to check this.

Here is the console command to dump all URL acls:

netsh http show urlacl

Check what's returned here, and if anything matches the url you are testing, here is the command to delete one URL acl (for example):

netsh http delete urlacl url=http://localhost:2018/

(beware to carefully note what you do here in case it was not related to the original problem)


I have a very busy website, and at peak times I get the service unavailable error. I ran the command you suggested and I see this: http://+:80/Temporary_Listen_Addresses/. Could this be causing the service unavailable issue for my website visitors?
@Vincent - I'm not sure but I don't think. This seems to be created by WCF: docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/… you should ask another question
This worked for me! I had some self hosting service running before and did some work to bind it to localhost:443. I also had to generate a self cert and bind it to 443. Somehow there are remenants (even after i deleted the cert, deleted the SSL Cert with: netsh http delete sslcert ipport=127.0.0.1:443. I also had to run: netsh http delete urlacl url=https://+:443/
In my case everything was fine under http, while https did have the 503 this answer led me to this command: netsh http show urlacl url=https://+443/ And to remove the link, i used: netsh http delete urlacl https://+443/
T
TylerH

In my case the problem was the DefaultAppPool. I changed the "Load User Profile" to false and now it works. However, I don't know if there are side effects to this.

https://i.stack.imgur.com/n7e4i.png

Further reading on setting the Load User Profile option: What exactly happens when I set LoadUserProfile of IIS pool?


@Pogrindis What do you mean, ambiguous? It loads the user profile, nothing more. Some operations depend on the user profile and others don't, but that's hardly an ambiguity in IIS - that's simply what a multi-user model of the system introduces. It gives you more isolation between applications running under different users. If you don't understand why this setting "fixed" something for you... that's most likely your problem - e.g. you're depending on some environmental variable, registry key or another resource in the user profile in an incorrect way.
@Luaan I agree completely, the problem being resolved by this lies with me and my understanding of IIS (or lack thereof), but there is quite a bit of ambiguity surrounding the terminology unless you are adept in the method for which IIS works. Having discovered why it resolved my problem is relieving. Everyday's a school-day.
R
Robotnik

Check your application's respective Application Framework Pool - it could be stopped. If it is, start it and check again.

If you're still experiencing issues you can also check out Event Viewer to find the cause of that error in order to troubleshoot more.


Yes, Event Viewer is your friend! I found this error occurred after the Sept 2016 Windows 10 Anniversary update - it somehow broke the IIS Rewrite 2 DLL module. Repairing it in "Programs and Features", and then restarting the App Pool, fixed it for me.
T
TylerH

If the app pool is running under some specific user identity, then go to the advanced settings and update the username and password again to ensure they are correct.


w
weir

If the app pool immediately stops after you start it and your event log shows:

The worker process for application pool 'APP_POOL_NAME' encountered an error 'Cannot read configuration file ' trying to read configuration data from file '\?\', line number '0'. The data field contains the error code.

... you may experiencing a bug that was apparently introduced in the Windows 10 Fall Creators Update and/or .Net Framework v4.7.1. It can be resolved via the following workaround steps, which are from this answer to the related question Cannot read configuration file ' trying to read configuration data from file '\\?\<EMPTY>', line number '0'.

Go to the drive your IIS is installed on, eg. C:\inetpub\temp\appPools\ Delete the directory (or virtual directory) with the same name as your app pool. Recycle/Start your app pool again.

I have reported this bug to Microsoft by creating the following issue on the dotnet GitHub repo: After installing 4.7.1, IIS AppPool stops with "Cannot read configuration file".

EDIT

Microsoft responded that this is a known issue with the Windows setup process for the Fall Creators Update and was documented in KB 4050891, Web applications return HTTP Error 503 and WAS event 5189 on Windows 10 Version 1709 (Fall Creators Update). That article provides the following workaround procedure, which is similar to the one above. However, note that it will recycle all app pools regardless of whether they are affected by the issue.

Open a Windows PowerShell window by using the Run as administrator option. Run the following commands: Stop-Service -Force WAS Remove-Item -Recurse -Force C:\inetpub\temp\appPools\* Start-Service W3SVC


This is the best answer, and it should be marked as answer.
S
Samuel Jack

Start by looking in Event Viewer, either under the System or the Application log.

In my case the problem was that no worker process could be started for the App Pool because its configuration file couldn't be read - I had included an extra '.' at the end of its name.


R
Ryan Rodemoyer

I resolved this issue by removing a URL reservation that matched my app directory in IIS. I had a similar (definitely not the same) issue as outlined in this article:

A Not So Common Root Cause for 503 Service Unavailable


H
Hallmanac

Or if none of the current solutions work, look in your website's directory for a file called app_offline.htm. That basically tells IIS that your site is unavailable and to show this page instead.

To fix it, either delete it or rename it to app_offline.htm.bak.

In my case, I added it while showing a colleague how to use that to prevent traffic to the site temporarily and then forgot that I did that on my box. Sigh.


H
Hashim Akhtar

It is possible that your domain requires the account used for running the AppPool to have batch logon rights. In which case you will see this same error message. The way you can tell if that is the case, is by looking at the System events in the Event Viewer. There should be an event saying that the account being used with the App Pool has either 'the wrong password or does not have batch logon rights'.

This is why developers quite often use IIS Express on their development machine, since it by passes the batch logon rights issue.


a
atconway

I ran into the same issue, but it was an issue with the actual site settings in IIS.

Select Advanced Settings... for your site/application and then look at the Enabled Protocols value. For whatever reson the value was blank for my site and caused the following error:

HTTP Error 503. The service is unavailable.

The fix was to add in http and select OK. The site was then functional again.


+1: Bingo! In my case, I began requiring SSL, so my fix was to add http, https in that same box. Thanks!
Yes! Apparently someone had changed the protocol to htt4p. No idea how that happened, but it's on an on-prem environment that my team doesn't manage. Super frustrating.
S
SushiGuy

Check Event Viewer - Windows - Application. If there is a red Error line made from IIS-W3SVC-WP and the message is like The Module DLL C:\Windows\system32\inetsrv\rewrite.dll failed to load. The data is the error. then you are missing some Windows Setup features.

In Windows Server 2012 go to Server Manager, Add Roles and Features, Web Server (IIS) and add the matching feature. Usually, most of the Application Development section is installed. Here is a complete list of IIS features and their associated DLL to help in diagnosis.

After going through a few iterations of that I ended on the error message above regarding "rewrite.dll". This led to a direct download and install of Microsoft URL Rewrite tool. Finally all websites came to life.


same scenario ! ReWrite module was missing from IIS. as you mentioned problem will be solved after installing it From Here
I had the URL Rewrite 2.0 module installed. However, I found that I needed to repair the installation in "Programs and Features" (Windows 10).
P
Patrick.SE

Our server ran out of disk space on Sunday afternoon which led to an application suddenly failing and returning HTTP error 502. The logs were empty so it had to be something that was occurring before IIS even did anything.

https://i.stack.imgur.com/KP9s0.png

It's a good idea to filter out the output of the System and Application windows to WAS since it can get pretty verbose in there.

The application depended on another one which was disabled. Therefore keep in mind an application can go down indirectly if one of it's dependent processes has gone down. We simply re-enabled the .NET application pool and our other application started running normally again.


C
Community

If you have IIS URL Rewriting installed it could be to do with that. I suffered issues after a Windows 10 Update.

This StackOverflow post helped me.

Go to Windows Control Panel > Programs and Features > IIS URL Rewrite Module 2 > Repair.


This was the answer. Requests to the site stop the started app pool because of the redirect module being 'corrupt' after a big update. Thanks.
M
Mahmoud Valizadeh

i see this error after install url rewrite module i try to install previous version of it from: https://www.microsoft.com/en-us/download/details.aspx?id=7435 it fixed my error


A
Avalanchis

In my case, the problem was that another application was using the port that I had bound to my web site.

I found it by running the following command from a command line, which lists all of the listening ports and the executable involved:

netstat -b

S
Stacked

If you have McAfee HIPS and if you see the following error in event viewer application log:

The Module DLL C:\Windows\System32\inetsrv\HipIISEngineStub.dll failed to load. The data is the error.

Then this workaround on McAfee.com resolved the issue in my case.

Quote from the page:

Click Start, Run, type explorer and click OK. Navigate to: %windir%\system32\inetsrv\config Open the file applicationHost.config as Administrator for editing in Notepad. Edit the section and remove the following line: Edit the section and remove the following line: After you have finished editing the applicationHost.config file, save the file, then restart the IIS server using iisreset or by restarting the system.


T
Tore Aurstad

Actually, in my case https://localhost was working, but http://localhost gave a HTTP 503 Internal server error. Changing the Binding of Default Web Site in IIS to use the hostname localhost instead of a blank host name.

https://i.stack.imgur.com/abv5Q.png


R
Ryan M

For my case, My Default Application Pool was offline.

To troubleshoot the problem, I checked the IIS logs located in C:\Windows\System32\LogFile\HTTPERR. Scroll down to the most recent error logs, this will show you problems with IIS if any.

My Error was "503 1 AppOffline DefaultPool"

Solution

Open IIS Manager

Click on Application Pools, this lists all application pool to your right.

Check if the application pools hosting your api or site has a stop sign on it. If so, right click the application pool and click start.

Try again to access your service from the client


A
ABDUL KHALIQ

I changed the port from 80 to 8080, that's why this error occur. I write localhost/ in search bar then this error occur. My problem is resolved by writing localhost:8080/ in the search then local host open.


I encountered the issue as well. Because I installed another app which also acts as a web server, and I didn't notice the port it used. Occasionally I browsed the default IIS web site, and got the 503 error. It didn't have any clue in the event viewer and IIS log, un-install and re-install IIS didn't help either. Finally I created another site in IIS with another port, and it worked, and I realized it's the port issue.
D
Daniel Persson

This happened to me on a server on our intranet. After browsing through blog posts and Windows logs, it turned out that a few days before Christmas 2015 (related to a Windows Update?) my web site application pool wanted to create a config file in folder c:\inetpub\temp\appPools, but access to this folder was restricted. This caused the application pool to be disabled.

After adding Full control to Everyone on this temp folder, I restarted the Windows Process Activation Service and everything went online again.

If I'd been a little more elegant, it would probably had been enough to grant the AppPool user full control to the folder, but I never seem to remember how the app pool name and app pool user relates to eachother...


P
Prabu Arumugam

This could also happen if any recent installs or updates happened with .NET framework and/or ASP.NET. If you are unsure of what happened recently and if all your apps use ASP.NET version 4, you can try reset them by running the following commands in command prompt in administrator mode.

cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319
aspnet_regiis -i

This makes sure to install or reinstall ASP.NET 4 and updates existing applications to use ASP.NET 4 version of the app pool. It updates both IIS Classic and Integrated mode handlers and script mappings in the IIS metabase. It also recreates ASP.NET v4.0 and ASP.NET v4.0 Classic app pools, and sets .NET framework 4 to DefaultAppPool and Classic .NET app pools.


1
1_bug

Same thing with IIS Express 10.0 after upgrading Windows 7 to Windows 10. Solution: go to IIS and enable all disabled websites and reinstall ASP.NET Core.


T
Tony L.

Also check the address bar and make sure the page is in the right location.

This error can be returned instead of the 404 (Page not found). In my case, it was a bad link on the page that didn't have a subfolder included.


S
Siemsen

I was having this problem when cleaning up my IIS on dev machine, and I had somehow created a virtual folder for a subfolder of my actual development web that I couldn't clear and was creating conflicts.

To clear it I had to use

C:\Windows\System32\inetsrv\appcmd.exe list vdir

and then individually remove the problem virtual directories using

C:\Windows\System32\inetsrv\appcmd.exe delete app /app.name:"Default Web Site"/{name of virtual directory}

R
Rohim Chou

https://i.stack.imgur.com/XbpgFm.png

For me the solution is to change Enable 32-bit Applications to False

None of the answers worked for me. So I'd like to share what I found after hours of research..

Keep seeing this message from event logs: The Module DLL C:\Windows\system32\RpcProxy\RpcProxy.dll failed to load. The data is the error. Turns out that dll is 64bit and cannot be loaded into 32bit process.


T
Tushar Wason

You can also try the following.

Right-click on the site and 'Basic Settings...' Click on 'Connect As...' Click on Specific User and give the new credentials.

Now it should work.


D
Dharman

In my case, I had to change my userPass of network because company policies. So, you need to edit your AppPool: click on Application Pools. Select your pool, 'advanced Settings...' go to 'Process Model' click on 'Identity' and Click on Specific User and give the new credentials.


u
user3225121

This might be because of number of connections to the database. I had such a situation and so, wrote a de-constructor and killed db open connection and it resolved.


How did you discover that you had too many db connections? And can you be more specific as to how you wrote this "de-constructor" and killed open db connections? And how did you determine which connections were safe to close (ie. no longer being used)?
C
Community

I had the same problem and found it was caused by permission problems creating the user profile in C:\Users. I gave ApplicationPoolIdentity full permissions to the C:\Users folder, started the site and everything worked, the profile must have been created properly, and my site worked as it should. I then removed access to C:\Users from ApplicationPoolIdentity.

Site wont start on local using ApplicationPoolIdentity, only when using NetworkService: "HTTP Error 503. The service is unavailable."