asp.net-mvc – 汇编绑定重定向不工作
|
我试图在Azure上部署一个测试Web应用程序,但是当我在本地机器上运行Azure模拟器时,我会从附加到我的WebRole的Azure模拟器控制台得到这个错误: 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=3.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,PublicKeyToken=31bf3856ad364e35' === Pre-bind state information === LOG: User = COLLABmirko.lugano LOG: DisplayName = System.Web.Mvc,PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///C:/Code/Application/<MyWebProject>.Azure/csx/Debug/roles/<MyWebProject>/approot/bin LOG: Initial PrivatePath = C:CodeApplication<MyWebProject>.AzurecsxDebugroles<MyWebProject>approotbin Calling assembly : ActionMailer.Net.Mvc,Version=0.7.4.0,PublicKeyToken=e62db3114c02a1c2. === LOG: This bind starts in default load context. LOG: Using application configuration file: C:CodeApplication<MyWebProject>.AzurecsxDebugroles<MyWebProject>basex64WaIISHost.exe.Config LOG: Using host configuration file: LOG: Using machine configuration file from C:WindowsMicrosoft.NETFramework64v4.0.30319configmachine.config. LOG: Post-policy reference: System.Web.Mvc,PublicKeyToken=31bf3856ad364e35 LOG: Attempting download of new URL file:///C:/Code/Application/<MyWebProject>.Azure/csx/Debug/roles/<MyWebProject>/approot/bin/System.Web.Mvc.DLL. WRN: Comparing the assembly name resulted in the mismatch: Major Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. ---> 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) [fabric] Role state Unknown 只要我在本地机器上安装了MVC3(MVC3程序集在GAC中),但是由于我删除了MVC3(Azure没有安装MVC),所以一直工作正常,我收到这个错误.我的网络应用程序经常包含MVC4,工作正常.我曾经想过装配绑定重定向,我注意到在我的web.config文件中我已经有: <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
...
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
...
</assemblyBinding>
</runtime>
这应该是正确的,根据我在互联网上阅读的文件.我也尝试将System.Web.Mvc.dll(版本4.0.0.0)的SpecificVersion属性设置为false,但无效.我错过了什么吗?不应该将调用组件ActionMailer.Net.Mvc自动重定向到正确版本的MVC程序集?任何想法都非常感激.谢谢. 解决方法在Azure WebRoles中,默认情况下(在完全IIS模式下),RoleEntryPoint将与WebRole的其余部分保持一致,并运行在不同的进程中.这样做的一个副作用是您的RoleEntryPoint将无法访问您的web.config. > Azure SDK 1.3 -1.7将查看WaIISHost.exe.config 随着SDK的最新更改,您应该可以在应用程序中放置一个app.config,然后角色入口点就可以访问它. 您可以在此Microsoft blog post或Stackoverflow post中阅读有关此更多信息 (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net – 命名Dom元素的Id属性的最佳实践
- asp.net – 处理缓存和浏览器后退按钮的最佳方法是什么?
- asp.net-mvc-4 – 如何在mvc4中将Json字符串发送到Controll
- asp.net-mvc – 我可以创建一个带有MVC3助手的选择列表
- 为ASP.NET/ASP.NET MVC配置IIS(Windows 7)3
- asp.net-mvc – LiveReload ASP.net MVC Web应用程序与Grun
- asp.net-mvc – ASP.NET MVC 5如何在Identity 2.0中删除用户
- asp.net-mvc – 实体框架更新实体以及子实体(必要时添加/更
- asp.net-mvc – 如何单元测试应用了[Authorize]属性的控制器
- asp.net – 如何使用HTML5电子邮件输入类型与服务器端.NET
- asp.net – 数据注释 – 使用属性扩展并在资源文
- asp.net-mvc-3 – 选择更改事件 – Html.DropDow
- ASP.NET MVC – 如何从局部视图中获取当前操作?
- 使用HtmlAnchor或ASP.NET HyperLink作为导航页内
- C# 快速高效率复制对象另一种方式 表达式树
- asp.net – Google OpenId:找不到OpenID端点(间
- ASP.NET Core 2.0和Angular 4.3文件上传进度
- asp.net-mvc – 属性路由和本地化问题
- asp.net-mvc – ViewBag在RedirectToAction之后为
- iis-7.5 – ASP.NET Web API仅在某些服务器上返回
