locked
Could not load file or assembly 'System.Web.Http.WebHost, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. on Deployed mvc.net application RRS feed

  • Question

  • User2038048451 posted

    Hi,

    i have developed an mvc.net web application and deployed in IIS on different server and getting below error.

    Server Error in '/' Application.

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

    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.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Http.WebHost, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. 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.WebHost, Version=5.2.3.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].

    I tired adding below lines in web.config, still facing same issue.

    <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
    </dependentAssembly>
    <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
    </dependentAssembly>


    Thursday, August 27, 2020 5:54 PM

All replies

  • User1686398519 posted

    Hi nrk_hi,

    1. You need to check the bin folder of the deployed project.

      • It should contain System.Web.Http.WebHost.dll.

      • If there is no such file, you need to go to the MVC Web application project and expand the "reference" node in the project tree. Select System.Web.Http.WebHost, and then in the "Properties" dialog box, set "Local Copy" to True.

    2. If this System.Web.Http.WebHost.dll is already located in the bin folder of the deployed project, please check its version. If it is not 5.2.3.0, version 5.2.3.0 should be deployed.

      • You can re-update the System.Web.Http.WebHost version in your MVC project to 5.2.3.0, and then republish it.

    Best Regards,

    YihuiSun

    Friday, August 28, 2020 7:42 AM