将 mvc nuget 包从版本 5.1.0 升级到 5.2.2 后,我们在 Azure 上的计算机 (webrole) 拒绝启动 Web 角色。它处于回收状态。我在事件日志中发现了一个错误:
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:
820
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=5.1.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=5.1.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
我尝试在互联网上搜索,但没有有用的答案。
除了降级之外我无法解决它。幸运的是,软件包版本 5.1.1 正在运行。
更新1:经过一番尝试和错误后,我发现 asp.net mvc 包直到版本 5.1.3 都可以
看起来 5.2.0 以上的软件包不受支持。
更新2:我们决定将我们的 web 和 web.api 分开,所以我不再遇到这个问题了。我最好的猜测是,确实有 nuget,它引用了旧的 asp.net mvc 包。
我有类似的问题。我们继承了一个项目,并将ASPNET MVC版本更新到5.2.2.0。我们无法部署到 Azure。我们能找到的唯一错误是您在这里提到的错误。
我们更正了每个 web.config 文件,以便将旧版本重定向到新版本,但我们仍然遇到同样的问题。
然后我们编写了一个小测试方法,迭代每个程序集,我们看到一个 NuGet 包仍在使用 Asp.net MVC 4.0。该软件包是旧版本,已经有一段时间没有更新了。我下载了源代码,更新了 Mvc Nuget 并手动插入了 dll。
我们再次部署,一切都很顺利。
这是测试方法。
private void TestAssemblies()
{
var allAssemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly item in allAssemblies)
{
PrintAssembly(item);
}
}
private void PrintAssembly(Assembly assembly)
{
foreach (var item in assembly.GetReferencedAssemblies())
{
if (item.FullName.Contains("System.Web.Mvc"))
{
Debug.WriteLine(item);
Debug.WriteLine("Parent: " + assembly.FullName);
Debug.WriteLine("------------------------------------------------------------");
}
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)