2012-12-18 4 views
4

mvc에서 웹 응용 프로그램을 개발했습니다. 4. 모든 것이 개발 컴퓨터에서 정상적으로 작동하지만 라이브 서버에서는 다음 오류가 발생합니다.Asp.net mvc 4 배포 오류

파일 또는 어셈블리를로드 할 수 없습니다

'System.Web.Http, 버전 = 4.0.0.0, 중립 문화 = PublicKeyToken = 31bf3856ad364e35'또는 해당 종속성 중 하나. 모듈에 어셈블리 매니페스트가 포함되어 있어야합니다. 나는 다음과 같은 솔루션을 시도

: 내 로컬 드라이브에서 bin 폴더에

  • 복사 dll 파일 내 호스팅 asp.net 4
  • 유무가 웹 체크 활성화되어 있음을
  • 을 검사
  • .config 파일이 올바르게 구성되었습니다.

정확한 화면 추적은 다음과 같습니다. 마지막 줄에 .net 버전 4와 asp.net 버전 4가 표시되므로 문제가 아닌 것으로 가정합니다. 제발 날 안내 해줘.

Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The module was expected to contain an assembly manifest. 

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.BadImageFormatException: Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The module was expected to contain an assembly manifest. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded. 


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]. 

Stack Trace: 


[BadImageFormatException: Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The module was expected to contain an assembly manifest.] 
    innovationtimes.MvcApplication.Application_Start() +0 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272 

는 여기에 내가 마침내 완수 관리 전체 web.config 파일

<?xml version="1.0"?> 
<!-- 
    For more information on how to configure your ASP.NET application, please visit 
    http://go.microsoft.com/fwlink/?LinkId=169433 
    --> 
<configuration> 
    <appSettings> 
    <add key="webpages:Version" value="2.0.0.0"/> 
    <add key="webpages:Enabled" value="false"/> 
    <add key="PreserveLoginUrl" value="true"/> 
    <add key="ClientValidationEnabled" value="true"/> 
    <add key="UnobtrusiveJavaScriptEnabled" value="true"/> 
    </appSettings> 
    <connectionStrings> 
    <!--<add name="DataContext" providerName="System.Data.SqlClient" connectionString="Data Source=pc1\SQLEXPRESS;Initial Catalog=itdb;User Id=sa;Password=12345;"/>--> 

    </connectionStrings> 
    <system.web> 
    <customErrors mode="Off"></customErrors> 
    <compilation debug="true" targetFramework="4.0"/> 
    <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.Routing"/> 
     <add namespace="System.Web.WebPages"/> 
     </namespaces> 
    </pages> 
    </system.web> 
    <system.webServer> 
    <validation validateIntegratedModeConfiguration="false"/> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    <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> 
</configuration> 
+0

System.Web.Http가있는 경우 web.config의 configuration/runtime/assemblyBinding 섹션을 게시 할 수 있습니까? – jbl

+0

질문을 편집했습니다. 그것을 통과하십시오 –

+0

시도해보십시오 :'Expand Reference'>'선택된 레퍼런스를 오른쪽 클릭하십시오'>'Go to Properties'>'Copy Local = true'를 설정하십시오. 그들 모두를 위해 그것을하십시오. 배포 서버에서 누락 된 항목 일 수 있습니다. – Kaf

답변

5

입니다. 그것이 비슷한 이슈를 가진 사람들에게 도움이되기를 희망한다.

범인은 게시 마법사입니다. 게시 도구를 사용하여 프로젝트를 게시했습니다. 그러나 게시 된 프로젝트를 업로드 할 때 단순히 작동하지 않고 system.web.http 어셈블리가 손상되었음을 나타냅니다. 나는 그것을 해결했다

방법 -

을 나는 마법사를 게시의 DLL을 덮어 내 프로젝트의 bin 폴더에서 system.web.http DLL을 업로드했습니다.

나는 다른 dll을 추가로 요구 받았고, 나는 그들 모두를 위해 똑같이했다.

오류가있는 DLL을 모두 내 bin 폴더의 폴더로 바꾼 즉시 응용 프로그램이 작동하기 시작했습니다.

Visual Studio 게시 마법사의 버그인지 확실하지 않습니다. 누구든지이 문제에 대해 더 잘 알고 있다면 다른 사람들의 도움을 위해 여기에 게시하십시오.

+0

감사합니다. – user217648

+0

이런 젠장, 고마워! –

+0

예. 그러나이 솔루션은 마법사 배포 문제를 해결하지 못합니다. 불행히도 나는 같은 문제에 직면하고있다. 우선 UAC - nop, 폴더 권리 때문에 그 모든 것을 생각했다. 권한을 파일로 보았습니다. 모두보기 좋습니다. 내가 시도해 볼 수도있는 것은 참조를 한 번 더 추가/추가하고 설치 프로그램을 다시 작성하는 것입니다 (msi). 어떤 생각? – stenly

0

나는 동일한 문제가있었습니다. 어떻게 든 게시 마법사는 릴리스 모드를 좋아하지 않았습니다. 릴리스 모드에서는 system.web.http.dll을 배포 한 다음 면도기 어셈블리를 계속 배포하지 못했습니다. 게시 마법사 설정에서 디버그 모드로 변경했을 때 마침내 작동했습니다. 물론 디버깅 모드에서 게시하는 것만으로도 해결책이되지는 않습니다. 그렇지 않으면 VS 게시 마법사보다 다른 게시 방법을 사용하십시오.