locked
ASP.NET MVC Web Application : Issue with System.Web.Http.WebHost assembly when debugging on iisexpress. RRS feed

  • Question

  • Hello,

    I have a problem when I'm trying to run an ASP MVC web application which is using Docuvieware because it's managing a large and heavy number of documents.

    I'm just trying to debug my application running it on iisexpress so using Debug mode.

    When the application starts running (global asax) it needs to read a key to connect Docuvieware, and is in this line where I'm getting this error below:

    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 located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    The exception System.IO.FileLoadException: 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 located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).

    I've got the assembly System.Web.Http.WebHost stored in my application bin folder and added it to the project references, the version of this assembly is v4.0.0.0.

    The web.config file is configured this way:

      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-5.8.1.0" newVersion="5.8.1.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-5.8.1.0" newVersion="5.8.1.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-5.8.1.0" newVersion="5.8.1.0"/>
          </dependentAssembly>
        </assemblyBinding>

    The version of the .NET Framework I've been using to build the application is 4.5.2

    I 've tried all the solutions I could imagine:

    1. Install Nuget package for Web API v 5.2.3 which was already installed.

    2. Repair it.

    3. Remove all assemblies from AppLocal/Local/Temp/Temporary ASP.net files

    4. Remove obj and bin dlls, clean and rebuild

    5. Delete the reference, clean, rebuild, reference again, build.

    I was wondering how can I downgrade my version of My System.Web.Mvc or how can I get a newer version of System.Web.Http.WebHost. As I said the version of System.Web.Mvc is 5.2.3 and the version of Http.WebHost is 4.0.0.0.

    Maybe this can work?

    Ah! This is the assembly load trace.

    === Pre-bind state information ===
    LOG: DisplayName = System.Web.Http.WebHost, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
     (Fully-specified)
    LOG: Appbase = file:///C:/Users/xxx/Desktop/MyApp/eApp/eApp/
    LOG: Initial PrivatePath = C:\Users\xxx\Desktop\MyApp\eApp\eApp\bin
    Calling assembly : GdPicture.NET.12.WEB.DocuVieware, Version=2.0.0.48, Culture=neutral, PublicKeyToken=c0ef0255d2b9754c.
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: C:\Users\xxx\Desktop\MyApp\eApp\eApp\web.config
    LOG: Using host configuration file: C:\Users\xxx\Documents\IISExpress\config\aspnet.config
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
    LOG: Post-policy reference: System.Web.Http.WebHost, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    LOG: Attempting download of new URL file:///C:/Users/xxx/AppData/Local/Temp/Temporary ASP.NET Files/root/acf93e7b/74b6624c/System.Web.Http.WebHost.DLL.
    LOG: Attempting download of new URL file:///C:/Users/xxx/AppData/Local/Temp/Temporary ASP.NET Files/root/acf93e7b/74b6624c/System.Web.Http.WebHost/System.Web.Http.WebHost.DLL.
    LOG: Attempting download of new URL file:///C:/Users/xxx/Desktop/MyApp/eApp/eApp/bin/System.Web.Http.WebHost.DLL.
    WRN: Comparing the assembly name resulted in the mismatch: Major Version
    ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

    Please, any help to solve this will be very appreciated. I've spent too much time, and I don't know what to do and I want to understand, what is happening.

    Kind regards.

    Maria






    • Edited by MariaDAH Wednesday, October 11, 2017 2:00 PM
    Sunday, October 8, 2017 1:16 PM

Answers