Invalid Web.Config Caused Failure To Deploy ASP.NET App To Windows Azure: “All role instances have stopped”, “Busy”, “Aborted”, “Recovering role...”, “Preparing node…”

Programming Windows Azure - Programming the Microsoft CloudImproper configuration settings in web.config caused failure to deploy and start Windows Azure role and instance. This is what I observed via Windows Azure Management portal with changing statuses as depicted below:

image

image

In Visual Studio I observed the following statuses:

image

After trying to figure out for several hours what’s going on I opened service ticket and the result was this:

Exception:System.Runtime.InteropServices.COMException (0x800700B7): Filename: \\?\E:\approot\_WASR_\0\web.config

Line number: 42

Error: Config section 'system.web/authentication' already defined. Sections must only appear once per config file. See the help topic <location> for exceptions

After removing the duplicate entry in the web.config I flawlessly could deploy my app, which is available at https://wawithacsv2.cloudapp.net/. It showcases federated authentication for ASP.NET app deployed to Windows Azure. Try it. Do not get spooked by certificate warning – I am using self signed certificate. You can trust me :).