Could not load file or assembly 'System.Web.Http.WebHost'

After deploying the MVC webpage in my IIS, I get the following error:

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

      

The following changes have been made to prevent this issue:

  • Install a copy of Local = True for web hosting
  • Added WebApi 2.2 from nuget
  • There is a bin folder in System.Web.Http.WebHost,
  • My web.config has the following dependAssembly:

code:

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

      

I am still getting the error, what am I doing wrong?

+3


source to share


1 answer


You may need to check the web config in your "views" folder, if you have one, to make sure it has the correct binding redirects as in your main web config.



0


source







All Articles