2016-04-29 181 views
1

我想上傳我的應用程序到主機,但是,我不斷收到此錯誤,我不知道如何處理它。即使我嘗試將程序集添加到我的項目中,也不起作用。無法加載文件或程序集與System.Web.Http,版本= 4.0.0.0

任何人有任何想法?我都是你的。先謝謝你。

Parser Error Message: Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error:

An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Source File: H:\Inetpub\vhosts\Panel.Test.com\httpdocs\web.config Line: 30

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

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

這裏是我的的Web.config

<configuration> 
    <appSettings> 
     <add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/> 
    </appSettings> 
    <system.web> 
     <pages validateRequest="false"/> 
     <httpRuntime requestValidationMode="2.0"/> 
     <customErrors mode="On"> 
      <error statusCode="404" redirect="~/error/default.html"/> 
     </customErrors> 
     <authentication mode="Forms"> 
      <forms name="MyAppCookie" loginUrl="Login.aspx" protection="All" timeout="120" defaultUrl="Default.aspx"></forms> 
     </authentication> 
     <authorization> 
      <deny users="?"/> 
     </authorization> 
     <compilation debug="true" targetFramework="4.0"> 
      <assemblies> 
       <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> 
       <add assembly="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
       <add assembly="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies> 
     </compilation> 
    </system.web> 

當然連接字符串已安全提出了清除。

+1

你上傳System.Web.Http.dll與你的項目?編譯後,它通常會在'bin'文件夾中結束。 –

+0

參考System.Web.Http.WebHost.dll。 –

+0

我的Bin文件夾中沒有任何內容,在我構建了我的項目之後,只有BLL和DAL以及其他的Dll被創建。我可以手動下載並放在那裏嗎? – SmackDat

回答

1

確保將System.Web.Http.dll與您的項目一起上傳。編譯後,它通常會在'bin'文件夾中結束。

+0

如果這些程序集安裝到GAC並且未在項目文件中設置爲CopyLocal,則它們將不在bin文件夾中。這對於開發機器上的GAC中的ASP.NET MVC程序集非常常見,並且它們的Web服務器上從未由Web託管公司在GAC中安裝。 –

0

我沒有找到這篇文章,但我不記得了,但在某些安全包更新後,新版本是4.0.0.1。刪除並安裝4.0.0.1爲我解決。

相關問題