Azure 웹 사이트에 게시 한 후 파일 또는 어셈블리 System.Web.Http.WebHost를로드 할 수 없습니다.
웹 프로젝트를 만들었고 Visual Studio에서 잘 실행됩니다. 그러나 azurewebsites에 게시 한 후 다음 오류가 발생했습니다. 무엇이 문제를 일으킬 수 있습니까?
파일 또는 어셈블리 'System.Web.Http.WebHost, Version = 5.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35'또는 해당 종속성 중 하나를로드 할 수 없습니다. 찾은 어셈블리의 매니페스트 정의가 어셈블리 참조와 일치하지 않습니다. (HRESULT 예외 : 0x80131040)
설명 : 현재 웹 요청을 실행하는 동안 처리되지 않은 예외가 발생했습니다. 오류 및 코드에서 발생한 위치에 대한 자세한 정보는 스택 추적을 검토하십시오.
예외 정보 : System.IO.FileLoadException : 파일 또는 어셈블리 'System.Web.Http.WebHost, Version = 5.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35'또는 해당 종속성 중 하나를로드 할 수 없습니다. 찾은 어셈블리의 매니페스트 정의가 어셈블리 참조와 일치하지 않습니다. (HRESULT 예외 : 0x80131040)
소스 오류 :
현재 웹 요청을 실행하는 동안 처리되지 않은 예외가 생성되었습니다. 예외의 출처와 위치에 관한 정보는 아래 예외 스택 추적을 사용하여 식별 할 수 있습니다.
어셈블리로드 추적 : 다음 정보는 'System.Web.Http.WebHost, Version = 5.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35'어셈블리를로드 할 수없는 이유를 확인하는 데 도움이 될 수 있습니다.
WRN : 어셈블리 바인딩 로깅이 꺼져 있습니다. 어셈블리 바인드 실패 로깅을 사용 가능하게하려면 레지스트리 값 [HKLM \ Software \ Microsoft \ Fusion! EnableLog] (DWORD)를 1로 설정하십시오. 참고 : 어셈블리 바인드 실패 로깅과 관련하여 일부 성능 저하가 있습니다. 이 기능을 끄려면 레지스트리 값 [HKLM \ Software \ Microsoft \ Fusion! EnableLog]를 제거하십시오.
다음은 web.config 파일의 일부입니다.
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers></system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.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="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
dll
게시 (배치 환경)에 없습니다. 이것이 로컬 웹 사이트에서는 작동하지만 Azure 웹 사이트 환경에서는 작동하지 않는 이유입니다.
그냥 할 Copy Local = true
어셈블리 (의 속성에 System.Web.Http.WebHost ) 다음 재배포을, 그것을 잘 작동합니다.
If you get the similar error i.e. some other assembly missing, then make that assembly to copylocal=true and redeploy, repeat this iteratively - if you are unsure of its dependencies.
If you are still looking for an answer, try checking this question thread. It helped me resolve a similar problem.
edit: The solution that helped me was to run Update-Package Microsoft.AspNet.WebApi -reinstall
from the NugGet package manager, as suggested by Pathoschild. I then had to delete my .suo file and restart VS, as suggested by Sergey Osypchuk in this thread.
I met the same problem and I resolved it by setting CopyLocal
to true for the following libs:
System.Web.Http.dll
System.Web.Http.WebHost.dll
System.Net.Http.Formatting.dll
I must add that I use MVC4 and NET 4
For me worked adding the following section to web.config
file:
<configuration>
...
<runtime>
...
<dependentAssembly>
<assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
...
</runtime>
...
</configuration>
This example stands for MVC 5.1. Hope it will help someone to resolve such issue.
For me it started working after selecting "Remove additional files at destination" in File publish options under settings on the publish dialog.
The dll is missing in the published (deployed environment). That is the reason why it is working in the local i.e. Visual Studio but not in the Azure Website Environment.
Just do Copy Local = true in the properties for the assembly(System.Web.Http.WebHost) and then do a redeploy, it should work fine.
I'm using vs2012 and i think the update KB2781514 changed some setting. All my System.Web.Http in my MVC4 project changed to false and i keeping received this message. I had changed the All file in this project
in publish property but its not working. Finally I have to change Copy Local = true
one by one and solved this problem.
I got the same error and I changed my version from 4 to 3 and it is solved:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- Ensure correct version of MVC -->
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
I had the same problem in my Application.
System.web.http.webhost not found.
You just need to copy the system.web.http.webhost
file from your main project which you run in Visual Studio and paste it into your published project bin
directory.
After this it may show the same error but the directory name is changed it may be system.web.http
. Follow same procedure as above. It will work after all the files are uploaded. This due to the nuget package in Visual Studio they download from the internet but on server it not able to download it.
You can find this file in your project bin
directory.
This happened to me on VS2013(Update 5)/ASP.NET 4.5, under project type "Web Application" that includes MVC and Web API 2. Error happened right after creating the project and before adding any code. Adding the following configuration fix it for me. After resolving "System.Web.Helpers" issue two more similar errors surfaced for "System.Web.Mvc" and "System.Web.WebPages".
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
I was missing several DLLs. Even if I manually copied them to the directory the next time I published they would disappear. Each one was already set to Copy Locally in VS. The fix for me was to set each one to Copy Locally false, save, build then set each one to copy locally true. This time when I published all of the DLLs published correctly. Strange
If you have multiple projects in your solution and one of your projects fails to build because of this error then ensure you have installed the WebApi Core nuget package in that project. Simply adding a reference to the System.Web.Http does not help, you need to install the correct nuget package into that project.
I had multiple projects in my solution and WebApi Core was already installed in another project. I referenced the System.Web.Http assembly by right-clicking and ticking the assembly from the list and it did not work on Azure, though locally it would build okay. I had to remove the manual reference and add the WebApi Core nuget package to each project that needed the assembly reference.
In the case if "Copy Local" is already True, I find it sometimes to work if you remove the files where it has been published to and publish again.
For example if you're using IIS, remove the websites and the contents of the directory to which they are published to, and publish again.
There might be older versions of files at the destination, so to ensure you aren't using older versions, delete everything before publishing again.
I removed the following entry from web.config and it worked for me.
<dependentAssembly>
<assemblyIdentity name="System.Web.Http.WebHost" culture="neutral" publicKeyToken="31BF3856AD364E35" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="5.2.6.0" />
</dependentAssembly>
Make sure the package version is equal across the solution. I just downgraded & upgraded Microsoft.AspNet.Mvc
package across the solution and the problem solved.
'IT story' 카테고리의 다른 글
Vue 2-Vue-warn 뮤팅 소품 (0) | 2020.06.22 |
---|---|
Objective-C에 강력한 형식의 컬렉션이 있습니까? (0) | 2020.06.22 |
Windows에서 Python 패키지를 어떻게 설치합니까? (0) | 2020.06.22 |
앱이 백그라운드로 이동할 때 Android에서 스크린 샷을 찍지 않도록하려면 어떻게합니까? (0) | 2020.06.22 |
자바 스크립트 : Ajax로 JSON 객체를 보내시겠습니까? (0) | 2020.06.22 |