1
Vote

Publish web project to cloud service - 500 internal server error

description

VS 2013

Create new django project (or bottle -- didn't test flask)
Create virtual env, install django (or bottle)
Convert to Windows Azure Cloud Service Project
Publish that project to a new cloud service

Browse to the published site, and you'll get a 500 internal server error.

Workaround

This is a known issue that we saw in NTVS and it occurs in PTVS as well. What happens is that at the "Convert to Windows Azure Cloud Service Project" step, we add some extra configuration to the default ServiceDefinition.csdef file.

Occasionally this fails and the extra tasks are not added. To correct the issue manually, open the ServiceDefinition.csdef file and ensure that the following startup task has been added. If it has not, the Startup element below can be added anywhere under the WebRole element.
<ServiceDefinition ...>
 <WebRole ...>
  ...
  <Startup>
   <Task commandLine="Microsoft.PythonTools.AzureSetup.exe" executionContext="elevated" taskType="simple">
    <Environment>
     <Variable name="EMULATED">
      <RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
     </Variable>
    </Environment>
   </Task>
  </Startup>

comments

huguesv wrote Feb 12 at 12:23 AM

Running in emulator gives the same result.

huguesv wrote Feb 12 at 12:53 AM

This worked fine on my machine on VS 2010 (Azure Tools 2.1) and VS 2012 (Azure Tools 2.2). Don't know what's going on with my VS 2013...

huguesv wrote Feb 12 at 1:15 AM

And now it's working fine in VS 2013. I can't figure out what changed.

The following 3 cloud services are ones that failed. Remote Desktop was enabled on them (same creds as our account). Maybe something can be figured out by looking at the files on them.
http://hvtut2cs.cloudapp.net/
http://hvtutcs.cloudapp.net/
http://hvbottlecs.cloudapp.net/

huguesv wrote Feb 12 at 1:55 AM

This just happened on VS 2013. I zipped the project that includes all files as they were after project (including virtual env, so it's pretty big).
\pytools\Bugs\2195\ItWorked.zip

And remote desktop is enabled on that one two, the name of cloud service is djitworked.

Zooba wrote Feb 12 at 3:39 PM

This is a known issue that we saw in NTVS and it occurs in PTVS as well. What happens is that at the "Convert to Windows Azure Cloud Service Project" step, we add some extra configuration to the default ServiceDefinition.csdef file.

Occasionally this fails and the extra tasks are not added. To correct the issue manually, open the ServiceDefinition.csdef file and ensure that the following startup task has been added. If it has not, the Startup element below can be added anywhere under the WebRole element.
<ServiceDefinition ...>
 <WebRole ...>
  ...
  <Startup>
   <Task commandLine="Microsoft.PythonTools.AzureSetup.exe" executionContext="elevated" taskType="simple">
    <Environment>
     <Variable name="EMULATED">
      <RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
     </Variable>
    </Environment>
   </Task>
  </Startup>
I'll also add this to the description to make it easier to find.

Zooba wrote Mar 20 at 5:15 PM

Occurred in 20319.03 - reactivating.