Reputation: 4871
I am trying to migrate an existing MVC 3 web site to an Azure web role. My development environment uses a host header:
lcladmin.mysite.com
The host header is setup in my hosts file to point to 127.0.0.1. If I use the default settings in ServiceConfiguration.csdef the site loads fine as 127.0.0.1, but the features that depend on using host headers don't work. So I tried setting the hostHeader attribute on the Binding in SericeConfiguration.csdef and now I get this error dialog in Visual Studio 2010:
*There was an error attaching the deubgger to the IIS worker process for URL 'http://lcladmin.mysite.com:81/' for role instance 'deployment(17).Azure.Admin_IN_0'. Unable to start debugging on the web server. The debug request could not be processed by the server due to invalid syntax.*
At this point I can browse the site in my web browser and everything seems to be working as it should and any existing breakpoints will get hit in VS. However, VS is unusable because of the modal error dialog with the above message.
Here's the contents of my ServiceConfiguration.csdef:
<ServiceDefinition name="Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"> <WebRole name="Admin" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Admin" hostHeader="lcladmin.mysite.com" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Admin" protocol="http" port="81" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
I don't think this is a problem specific to the site I am migrating either. If I add a new Azure project to my solution, and a new MVC 3 web role and the only change I make is to add the hostHeader attribute, it does the same thing.
Upvotes: 2
Views: 916
Reputation: 3800
This blog entry by Michael Neel solved the same problem for me: Debugging Azure WebRoles with Multiple Sites
After reading Michael's entry, the key for me was to get the right ip address in the hosts file - like mentioned in one of the comments of his entry - my ip needed to be 127.255.0.0 (which you can look up on your system in IIS after the deploy has happened to the azure emulator, look at the site's bindings)
Upvotes: 4