When you host an ASP related website with a shared Windows server, you may have run into an Error 503 Service Unavailable. Actually, there may be 4 reasons for this error. We will introduce them in detail and help you to resolve this issue accordingly in the following parts. Now, please go on reading.
1. .NET CLR Version & Managed Pipeline Mode
Once your .NET CLR version is not set correct, your website couldn't work properly. Some web-hosting providers only provide 1 dedicated application pool for each hosting account in a shared Windows server. Thus, when you run more than 1 website with different .NET framework hosted with one account, they will get conflicted with each other.
For example, you can successfully run a website named A.com when you use .NET 2.0. However, when you try running another website named B.com with .NET 4.0, it's very likely for you to run into 503 error at A.com. This is because the operation of B.com updated the shared application pool to .NET CLR Version 4.0.
The same logic goes for Managed Pipeline Mode, which has 2 types: Integrated and Classic.
By using local or remote IIS management, you are able to open your IIS Manager and find application pool. Then click Advance Settings. Here is what you can see as it shows:
If you're not allowed remote International Information Services management, you should go to your WebSitePanel, find "Extensions" in "Your Site" part and pick the correct ASP.NET pipeline.
2. Enable 32-Bit Applications
This is another possible reason for Error 503, which can be found in the above placed screenshots. Here are the 3 most common reasons for this Error 503 caused by Application Pool Bit Mode setting.
- The Classic ASP site can only work in an environment with 32-bit. You're likely to confront this error if you: run a .NET site in an environment with 64-bit and it is hosted with a Classic ASP site or run a site with 64-bit set default by us.
- Your .NET site is specifically compiled with 32-bit or 64-bit environment, but it is hosted with another mode.
- Your .NET site requires library that run with 32-bit or 64-bit environment, but it doesn't operate that way.
A code bug may cause a site's application pool crashed, thus resulting to Error 503. If you can change the source code, you'd better add the following logging function to Application_Error of Global.asax.cs. As thus, you're able to find some clues in the log file if you confront this issue next time. Read the following code snippet.
protected void Application_Error(object sender, EventArgs e)
string logFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs.txt");
using (StreamWriter sw = new StreamWriter(logFilePath, true, System.Text.Encoding.UTF8))
4. The Limitation of Your Web Host
If 503 Error is not led by the above 3 reasons, then it may be the limitation we set that evokes. Specifically speaking, there are 2 reasons: CPU limit and Private Memory Limit. Most hosting providers have set limitation of CPU and private memory, though they may not state the fact in public. The aim for that is to avoid the server being overused by one user.
If that is the case, you can contact our technical support team for the 2 figures, and get to know the right expectation. If your site constantly occupies more than 500 MB memory or 10 percent of local server CPU, then you should optimize your codebase.
The latest IIS versions permit web-hosting providers to configure the CPU limit of an application pool so that the worker process of your website is able to use a certain amount of CPU at maximum. When your site comes with a large number of traffic or confronts a complicated situation at one time, the limit will be exceeded and your website worker process will be disabled. Before the worker process is able to restarted, you may run into this error.
You are able to find CPU limit for an application pool in your local Internet Information Services as it shows below.
The above screenshot shows that once the occupation of your server CPU is up to 15 percent, the worker process of your website is disabled and will be restarted in 5 minutes. During this period, you will experience the Error 503.
Private Memory Limit
Besides CPU limit, the private memory limit may also cause the same problem as you can see in the screenshot below. It indicates that when your site uses up more than the limited maximum memory, the worker process of your site will be recycled automatically. As thus, there is an Error 503 temporarily before it is restarted.
The above 4 factors are the main reasons that lead to Service Unavailable 503 Error. If you acquire them and you can quickly find the solution to this issue. As a Microsoft certified ASP.NET hosting provider integrating each package with at least 256 MB private memory, Host4ASP.NET can help you avoid this issue.