views:

31

answers:

3

I just started using VS 2010 to create a Cloud Service (HealthTracker), and I attached a MVC2 web project to it. When I hit Debug, the dev fabric was started and I was able to navigate my web app on my machine as expected.

I decided MVCWebRole2 was a bad name for my web app, so I renamed it to HealthTrackerMVC. I used Refactor --> Rename to change MVCWebRole2 to HealthTrackerMVC. I Built clean and now when I hit debug the dev fabric starts, and the web app never starts and eventually it exits debug mode without me doing anything.

How do I fix this? I'd rather not start over with everything...

UPDATE

I have checked the ServiceConfiguration.cscfg, the ServiceDefinition.csdef and the solution file. All the names match, and all the GUIDs match. I even renamed the folder that housed HealthTrackerMVC (formerly named MVCWebRole2) and edited the solution file to point to the new project. Everything loads and builds correctly. The Development Fabric shows HealthTrackerMVC starting, says it's busy, then shuts it down, rather quickly. See the attached screenshot:
alt text

So I know my web role is being started... why is it shutting down so quickly?

+2  A: 

Check the Azure configuration files, as both reference the role name and I don't belive VS's refactor command hits. If your project is building and the role simply isn't launching, its most likely as a result of the role not knowing what to start.

In ServiceDefinition.csdef

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="YourAzureService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"&gt;
  <WebRole name="HealthTrackerMVC" vmsize="Small" enableNativeCodeExecution="true">

...

In ServiceConfiguration.cscfg

<?xml version="1.0"?>
<ServiceConfiguration serviceName="YourAzureService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration"&gt;
    <Role name="HealthTrackerMVC">

...

If that doesn't work, right click on "Roles" under the Cloud Service Project in Solution Explorer. The ADD menu should have an option for "Web Role Project in Solution". Select that and link up your new role. Delete the old role as well at this point


If that still doesn't work, go to the file system where the project is stored and open the .ccproj file (Cloud Service Project) in a text editor.

Look for the reference to the previous role (ccproj are in MSBUILD format). It will be something like:

 <ItemGroup>
    <ProjectReference Include="Folder\MVCWebRole2.csproj">
      <Name>YourAzureService</Name>
      <Project>{26f72b59-1423-4175-b401-9c8f5f45db2a}</Project>
      <Private>True</Private>
      <RoleType>Web</RoleType>
      <RoleName>MVCWebRole2</RoleName>
    </ProjectReference>
  </ItemGroup>

Change references to the new HealthTrackerMVC project (name and .csproj ref) and you should be good to go. Most likely the project GUID hasn't changed, but if somehow it did, just open up the SLN file to get that number.

Once you change on this VS should prompt to reload the Solution/Projects. If not, you should reload anyways.

Taylor
This was helpful, but didn't solve the problem. Also, the option to Add "Web Role Project in Solution" was greyed out.
Nathan DeWitt
Greyed out means the UI is already referencing the only .csproj available to the solution, which is likely. Based on your edit something is crashing the fabric. Was the name change the only thing you changed? (ie Did you change class names, etc while at it)
Taylor
+1  A: 

I recommend to check Web.config and the actual start-up logic (i.e. Azure fabric is known to silently kill web projects with invalid web config without raising any errors; that's something that just made my life exciting a few times).

Just some ideas. For example you can try by starting web project alone (just like a usual project). If it works - drop an existing web role and add a new one to the solution (referencing this web project) and try running it in the dev fabric. If it does not, but web project runs alone - export it to a fresh solution and add to a new web role there.

Rinat Abdullin
A: 

This is a bit of a long shot, but if you have overwritten the RoleEntryPoint and overwritten the Run method, it should contain something like

public override void Run()
{
    while (true)
    {
        Thread.Sleep(8000);
    }
}

If this method ever returns, your application will stop.

knightpfhor