无法使用 System.Web.Http、版本=4.0.0.0 加载文件或程序集
Cannot load file or assembly with System.Web.Http, Version=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>
当然,出于安全考虑,连接字符串已被清除。
确保与您的项目一起上传 System.Web.Http.dll。它通常在编译后在 'bin' 文件夹中结束。
我没有找到那篇文章,我也记不太清了,但是在某些安全包更新之后,新版本是 4.0.0.1。删除并安装 4.0.0.1 为我解决了。
我正在尝试将我的应用程序上传到主机,但是,我一直收到此错误并且我不知道如何处理它。即使我尝试将程序集添加到我的项目中,它也不起作用。
有人有什么想法吗?我都是你的。先感谢您。
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>
当然,出于安全考虑,连接字符串已被清除。
确保与您的项目一起上传 System.Web.Http.dll。它通常在编译后在 'bin' 文件夹中结束。
我没有找到那篇文章,我也记不太清了,但是在某些安全包更新之后,新版本是 4.0.0.1。删除并安装 4.0.0.1 为我解决了。