2014-10-22 61 views
1

我面臨的問題與this問題中的問題非常相似。角色遇到錯誤並已停止

我們使用webrole在Windows Azure上部署了一個標準的MVC5應用程序。

部署我可以看到下面的錯誤消息在Visual Studio的微軟Azure活動日誌「窗口

Your role instances have recycled a number of times during an update or upgrade operation. This indicates that the new version of your service or the configuration settings you provided when configuring the service prevent the role instances from running. Verify your code does not throw unhandled exceptions and that your configuration settings are correct and then start another update or upgrade operation. 

後,我可以看到下面的錯誤信息管理控制檯上。

Restarting (Role has encountered an error and has stopped. Sites were deployed. [2014-10-22T04:46:57Z]) 

我在事件查看器中發現了以下錯誤消息。 (內部VM)

The description for Event ID 1007 from source Windows Azure Runtime 2.4.0.0 cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer. 

If the event originated on another computer, the display information had to be saved with the event. 

The following information was included with the event: 

    2232 
    WaIISHost 
    Role entrypoint could not be created: System.TypeLoadException: Unable to load the role entry point due to the following exceptions: 
    -- System.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 
    File name: 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 

    WRN: Assembly binding logging is turned OFF. 
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. 
    Note: There is some performance penalty associated with assembly bind failure logging. 
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. 

    ---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. 
     at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) 
     at System.Reflection.RuntimeModule.GetTypes() 
     at System.Reflection.Assembly.GetTypes() 
     at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetRoleEntryPoint(Assembly entryPointAssembly) 
     --- End of inner exception stack trace --- 
     at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetRoleEntryPoint(Assembly entryPointAssembly) 
     at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.CreateRoleEntryPoint(RoleType roleTypeEnum) 
     at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum) 

    the message resource is present but the message is not found in the string/message table 

我不知道爲什麼它指的是版本4.0.0.0 我的web.config文件的部分看起來是這樣的。

<runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="Microsoft.WindowsAzure.Storage" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 

回答

1

我得到了這個問題的解決方案。我找到了WaiISHost.exe的位置並通過向其添加綁定重定向語句修改了現有的WaIISHost.exe.config文件。

下可以找到這個文件「E:\基地\ 64」

2

您的web.config控件w3wp.exe,但您的調用堆棧指示您在WaiISHost.exe中崩潰。你有幾個選項:

  1. 爲什麼你在你的角色入口點DLL(通常是WebRole.cs)中引用System.Web.Mvc?如果你可以重構你的代碼的這部分,那麼你不必擔心在WaiISHost過程中加載這個DLL及其所有的依賴關係。
  2. 使用與您的web.config中相同的綁定重定向創建app.config。
+0

我會盡量檢查第一點。我不太確定。爲了快速修復,我嘗試了第二種選擇。我在下創建了文件App.conifg,只有一個部分,即包含所有綁定重定向的。我把這個文件放在我的站點部署的'E:\ sitesroot \ 0'下,並且放在'E:\ approot'下面,但是我仍然得到相同的錯誤。我也嘗試將文件重命名爲'WallSHost.exe.config',但徒勞無功。來自你方的任何其他輸入? – user2243747 2014-10-22 23:37:13

0

我有這個問題5.1版本,我不得不設置的MVC DLL copytolocal =真。我相信它與之前的MVC安全更新有關。這是微軟強烈要求更新MVC的蠻橫手段。