Partager via


Troubleshooting Scenario 5 – Internal Server Error 500 in WebRole

 

This post will describe how to troubleshoot an Internal Server Error 500 in an Azure webrole. This is a continuation of the troubleshooting series.

Symptom

You have deployed your WebRole, which works perfectly fine on your development machine, to Windows Azure and it shows as Ready in the portal, but when you browse to the site you get:

500 - Internal server error.

There is a problem with the resource you are looking for, and it cannot be displayed.

image

 

Troubleshooting

If the role itself is showing Ready in the portal, but there are functional issues with your hosted service (ie. this 500 Internal Server Error) then the first and easiest step is to RDP to the Azure VM and attempt to browse to the site using the DIP. The DIP is the VM's internal IP address (a 10.xxx or 100.xxx address) which you can get from ipconfig or IIS Manager. This will give you the more detailed error information that you would expect to get when browsing a website from the server where IIS is running. Typically the error and root cause of the issue will be immediately apparent.

image

The easiest way to browse the website on the local DIP is to open IIS Manager, expand Sites and click on the website. On the right-hand side you will see ‘Browse Website’. Alternatively you can use ipconfig to get the local IP address and then open Internet Explorer and browse to that address, but if your site is not on the standard port 80 you will also have to find the port number. You can get the port number from IIS Manager, the management portal, or your .csdef file, but in general it is just easier to browse directly using IIS Manager.

image

Browsing to the local DIP in IE will result in more detailed error information:

image

In this case we can see the following problem:

Error Code
0x80070032

Config Error
The configuration section 'system.web.webPages.razor' cannot be read because it is missing a section declaration 

 

Solution

This particular problem can be resolved by adding the razor sectionGroup settings to your web.config file. But more generically this blog post is meant to show you how to get the detailed error information, which at that point should be easy enough to do a quick web search to find a solution.

Comments

  • Anonymous
    March 14, 2014
    Hey, That's like the 3rd time your blog gives me the precise answer for what I was looking for, so thanks a lot! You're like a new Russinovich! Cheers, Charles

  • Anonymous
    September 04, 2015
    Very useful, this solved a problem for me I was diagnosing for over a day.

  • Anonymous
    September 20, 2016
    Well once in IIS I don't see any site there for my Worker Role so obviously there's something wrong with this blog or it maybe outdated

    • Anonymous
      September 27, 2016
      Hi Marc. This post is about a web role, not a worker role. For a worker role your code runs in WaWorkerHost.exe, and IIS is not configured on the VM.