Pages

Friday, May 3, 2013

Server Error 500 Solved : Azure Emulator and ASP.NET MVC

Hi Guys,

A quick post on how we solved the strange issue in Azure Emulator.
We had our ASP.NET MVC site up and running , but when we used to run it in the Azure Emulator - we used to get an error with code 500.

After long research and reading various posts on it , nothing helpful was found.

What was the reason behind this error?

There is a class file named WebRole.cs for any web role project in Azure. This class is inherited from another class known as RoleEntryPoint.
So the WebRole.cs usually contains override of a method known as OnStart().
There are few more methods you can override in this class like OnStop() and OnRun()

In our case the OnRun() method was having empty implementation and was missing base.Run() statement which was causing the problem.

After adding simply one statement i.e. base.Run() in the OnRun() method everything started working fine.

Hope this helps someone.

No comments:

Post a Comment