我们最近在Azure托管的Windows Server 2012 VM上部署了Umbraco 7.1.9应用程序。该应用程序在我们的开发人员计算机上本地#1工作,但当我们在VM上部署网站时,我们收到此错误:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Reflection.ReflectionTypeLoadException: Could not load types from assembly umbraco, Version=1.0.5443.21812, Culture=neutral, PublicKeyToken=null, errors:
Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.Editors.ContentPostValidateAttribute'. Assembly: 'umbraco, Version=1.0.5443.21812, Culture=neutral, PublicKeyToken=null'.
Exception: System.TypeLoadException: Could not load type 'System.Web.Http.Controllers.IControllerConfiguration' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Exception: System.TypeLoadException: Could not load type 'System.Web.Http.Controllers.IControllerConfiguration' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Exception: System.TypeLoadException: Could not load type 'System.Web.Http.Controllers.IControllerConfiguration' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.EnsureUserPermissionForContentAttribute'. Assembly: 'umbraco, Version=1.0.5443.21812, Culture=neutral, PublicKeyToken=null'.
Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.EnsureUserPermissionForMediaAttribute'. Assembly: 'umbraco, Version=1.0.5443.21812, Culture=neutral, PublicKeyToken=null'.
Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.FileUploadCleanupFilterAttribute'. Assembly: 'umbraco, Version=1.0.5443.21812, Culture=neutral, PublicKeyToken=null'.
Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.FilterAllowedOutgoingMediaAttribute'. Assembly: 'umbraco, Version=1.0.5443.21812, Culture=neutral, PublicKeyToken=null'.
Exception: System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Umbraco.Web.WebApi.Filters.FilterAllowedOutgoingMediaAttribute'. Assembly: 'umbraco, Version=1.0.5443.21812, Culture=neutral, PublicKeyToken=null'.
Exception: System.TypeLoadException: Could not load type 'System.Web.Http.Controllers.IControllerConfiguration' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Exception: System.TypeLoadException: Could not load type 'System.Web.Http.Dispatcher.DefaultHttpControllerSelector' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
我们安装了最新版本的.NET Framework,服务器上的每个更新都无法使用。
任何人都有类似的问题吗?
答案 0 :(得分:1)
编辑:这里有用的帖子......
这没有帮助...
我还没有看到这个问题,但我现在正在将Web.config从7.1.4升级到7.1.9,并且我注意到了两件可能对您有帮助的事情。
最近添加了:
<add assembly="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
System.Web.Http:
的Web.config中没有这样的内容<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly>
让我想知道你的问题的答案是否可能会增加这个:
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
或者这个(seen here):
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
</dependentAssembly>
答案 1 :(得分:1)
不确定是否对其他有此问题的人有帮助,因为它对我们的项目非常具体。
我们添加了依赖于LowercaseRoutesMVC4
的{{1}}包,这是一个未列出的包。它引用了AspNetWebApi.Core
的错误版本。我卸载了这个包,在我的路由配置中使用了System.Web.Http
属性而不是NuGet包,现在一切都按预期工作。