我一直在尝试将一个新的asp.net mvc项目部署到Azure进行生产.一切都在本地工作,但我在部署时遇到组件问题.
导航到大多数页面后,我开始收到以下错误:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
使用以下信息:https://stackoverflow.com/a/8824250/1411764我发现了异常:
Could not load file or assembly 'Microsoft.Web.Administration, Version=7.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Microsoft.Web.Administration
似乎是一个IIS程序集.
然后我Microsoft.Web.Administration
使用Nuget添加到项目中.
现在我遇到了一个新的错误:
Could not load file or assembly 'Microsoft.Web.Administration' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
我已经尝试将绑定重定向添加到web.config中
此时它会立即断开,我无法加载任何页面.(似乎比我没有额外的dll时更糟糕.
我看过很多类似的帖子,但似乎无法弄清楚.希望我对Azure缺乏了解会做一些简单的错误.任何帮助将非常感激.
更新的信息
右键单击属性以供参考Microsoft.Web.Administration
:
复制本地:真
运行时版本v2.0.50727
版本:7.0.0.0
调用程序集:Microsoft.WebMatrix.Core,Version = 8.1.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35
更新2 - 来自评论:
设置绑定到7.0.0.0
它后现在再次在服务器上编译并可以显示一些页面,但我仍然捕获以前的错误.
Could not load file or assembly 'Microsoft.Web.Administration, Version=7.9.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)
我假设Nuget只提供了版本,7.0.0.0
但有些东西认为它需要7.9.0.0
.
更新3:成功
我开始研究版本号差异,发现这个堆栈问题解释了IIS和IISExpress之间的一些差异.
现在我改变了从重定向7.9.0.0
到7.0.0.0
这似乎解决了这个问题.
程序集现在可以工作,页面都在加载.
这个解决方案虽然感觉非常hacky.是绑定到较低版本的不良做法还是可能导致将来出现问题?我担心我应该解决调用不同IIS版本的代码.