Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Web Role stuck initializing

edit: I figured it out. Well almost :) I fixed this issue, but I found another one. Documenting the solution here.


I have an MVC web role I am trying to deploy to Azure. It keeps bouncing from Starting > Initializing. I have done my research, and found two main causes for this.

  1. One of the assemblies I am using does not have Copy Local = True set
  2. The diagnostics connection string is wrong.

I Have triple checked my diagnostics connection and it is fine. I can use the exact same connection string in a Worker Role and it starts just fine So I assume the problem is related to #1 above.

This was a standard MVC project I added an azure deployment project to, so my guess is I am missing something an "Azure web role project" would automatically do for me. I already selected the "Add deployable assemblies" option from the projects context menu so the MVC bits should be set up, right?

Here is a list of my references, the items highlighted have Copy Local = true. Am I missing one? What else do I need to do to get this to deploy? Are there any diagnostics tools I can use to help me figure it out?

update:
I love when I find more information :)

So I was finally able to catch it in a state when I can remote into the server. I opened IIS and saw everything was there that should be. I tried to hit the site locally, but I get this error. The assembly IS included in my deploy, so it doesn't make sense that it can't find it. It seems like it is trying to load a different version than what was packaged.

Could not load file or assembly 'System.Web.WebPages' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

So there is (at least one of) my error.....but why? The site runs fine in IIS express, and it runs fine in development fabric. I feel like a noob here. What did I do wrong?

enter image description here


2 Answers

I had a reference to V2 of System.WebPages, but bin_dependencies had V1 in there. I Don't know how this happened, but making sure everything was on the right version worked.

I would like to know which MVC version you’re using. If you use MVC 3 or 4, please redirect the CLR runtime to the new versions of the assemblies. For example, for MVC 3:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

If you create a new MVC web role, this will be automatically configured. If you migrate an existing MVC application to Windows Azure, it is needed to configure it manually.

Best Regards,

Ming Xu.

like image 27
Ming Xu - MSFT Avatar answered Dec 15 '25 15:12

Ming Xu - MSFT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!