1

I am trying to upload my application to a host, however, I keep getting this error and I don't know how to handle it. Even if I try to add the assembly to my project, it does not work.

Anyone has any ideas? I am all yours. Thank you in advance.

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

Here is my 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>

Of course Connection-string has been cleared for security proposes.

4
  • 1
    Did you upload System.Web.Http.dll with your project? It usually ends up in the 'bin' folder after compiling. Commented Apr 29, 2016 at 12:47
  • refer System.Web.Http.WebHost.dll. Commented Apr 29, 2016 at 12:51
  • There is nothing in my Bin folder, after i did build my project, only BLLs and DAL and afew other Dlls were made. Can i Manually download it and put in there? Commented Apr 29, 2016 at 12:53
  • @GabrielLuci I've tried your way and it worked. please Add your answer and let me Accept it, thank you. Commented May 3, 2016 at 7:09

2 Answers 2

1

Make sure to upload System.Web.Http.dll with your project. It usually ends up in the 'bin' folder after compiling.

Sign up to request clarification or add additional context in comments.

1 Comment

Such assemblies will not be in bin folder if they are installed to GAC and are not set as CopyLocal in project files. That's quite common for ASP.NET MVC assemblies, which are in GAC on development machine, and never installed by web hosting companies in GAC on their web servers.
0

I don't find the article and I don't remember well but after certain security pack update the new version is 4.0.0.1. Remove and install 4.0.0.1 solved for me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.