How to create a Windows Azure Web Role based application using ASP.NET MVC4 template

How to create a Windows Azure Web Role based application using ASP.NET MVC4 template.


  • Visual Studio 2010 Pro/Express
  • Windows Azure SDK 1.5 (You know, Microsoft already released the latest SDK 1.6.)
  • You can get ASP.NET MVC4 from this link

1. After installed ASP.NET MVC4, you can create a new cloud application.


2. You can select ASP.NET MVC4 based Web Role as below.


3. Now you will be asked to choose ASP.NET MVC4 template as below so choose one of the given template and then select your view engine between Razor or ASPX.


4. Your project will open in VS2010 (or Visual Studio Web Developer). In the Solution Explorer windows, you will see the project details as below:


5. After it you can just launch your Windows Azure Cloud application in “Compute Emulator” by selecting Debug -> Start Debugging / Start Without Debugging.


What is REST?

It is rather style or pattern of development resource-oriented web applications. Beauty of REST is that its really easy to understand and basically you are using REST everyday but may not noticing that. REST works on top of HTTP protocol, but is is not protocol itself. It seems to me that it actually appears with HTTP/1.1 but only with Roy Fieldingwork it became well understood, defined and attractive.

REST popularized by such applications as twitter, flickr, bloglines, technorati etc. And of cause, by Ruby On Railsframework.


Sure, REST is not first who approaches issue of using recourses in Web, it rather trendier new kind in a block. We know bunch of web technologies, SOAP, WSDL, ATOM, WS-*, WCF, ODATA and many many more.. So, what are the difference?

Major difference is that all above are protocols, but REST is style. This has pros and cons. Protocol’s are more strict and heavyweight, with a number of rules, formats etc. SOAP is using XML as data exchange format, REST could work any format depending on client needs. SOAP is using its own security model, REST relies on HTTP and web server security. SOAP requires tools, REST learning curve is small and less less reliance on tools. SOAP designed to handle distributed computing environments, REST assumes a point-to-point communication model.

But my opinion is simplicity always win against complexity. Key popularity of REST is because is simple, easy understand by developers and as a result – implemented in applications. My believe that SOAP and other heavyweight protocols will slightly die more and applications will be using REST. MVC and REST

Developers of MVC framework designed it to be REST compatible. In the level of framework, there is an URL routing system (System.Web.Routing) that allows you easily follow REST design principles. It gives you total control over your URL schema and its mapping to your controllers and actions, with no need to conform to any predefined pattern.

So, basically MVC web applications development is: create a controller class (LoginController for instance), implement number of actions (Index, CheckCredentials) and map those actions to particular URL. For instance mapped to LoginController.Index method, that handles GET request from server and return View, containing Login form. mapped toLoginController.CheckCredentialsmethod, that handles POST and checks users credentials.

It is much more easier to create web applications API’s with MVC framework. TheActionResult is polymorphic, so it could return HTML, JSON, XML results (and you are free to implement own ActionResult, for any format you might need).

ASP.NET error CS0016: Could not write to output file

If you attempt to run an ASP.NET application hosted on IIS7.0 running on Windows Home Basic or Premium (Vista or Windows 7, x86 or x64), you may receive the following error:

error CS0016: Could not write to output file 

The problem occurs because Windows Home Basic and Premium lack Windows Authentication. You can solve this problem with a few mouse clicks:

1.  Run the Internet Information Services (IIS) Manager program.  It can be found in the Start > Administrative Tools menu.  You may have to edit the Start Menu properties to show the Administrative Tools folder.

2.  Select the Application Pools item in the Connections pane.

3.  Right-click on the application pool in which you are running your ASP.NET application.  On my PC, this was the DefaultAppPool.

4.  Select Advanced Settings from the popup menu.

5.  In the Process Model section, set the Identity to LocalSystem.  Click the OK button.