question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't load Microsoft.AspNetCore.Hosting 1.1.0.0

See original GitHub issue

In the course of trying to help the EF Core team verify that a bug I’d run across was fixed in v1.1, I updated a functioning solution to both EF Core 1.1 and AspNet Core 1.1.

And I really, really, wish I hadn’t.

First off, my previously-functioning MVC6 site stopped working, complaining about a version mismatch on Microsoft.Logging.Abstractions (I think it involved not being able to find v1.0.0 of that assembly).

So I figured I’d just revert everything back to where it was before I did the test for the EF Core team. That should fix everything, right?

Wrong.

Now I’m getting the following:

System.IO.FileLoadException was unhandled Message: An unhandled exception of type ‘System.IO.FileLoadException’ occurred in Unknown Module. Additional information: Could not load file or assembly ‘Microsoft.AspNetCore.Hosting, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Here’s the project.json file for the MVC6 app:

{
  "userSecretsId": "aspnet-ConnellCampaigns-ddb1a50a-eba1-4870-91d4-4d26457f64ce",

  "dependencies": {
    "AutoMapper": "5.1.1",
    "BundlerMinifier.Core": "2.2.296",
    "ConnellData": "1.0.0-*",
    "ConnellDataCore": "1.0.0-*",
    "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Azure.WebJobs": "1.1.2",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.0.1",
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.Extensions.Caching.Memory": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.WindowsAzure.ConfigurationManager": "3.2.3",
    "Serilog": "2.3.0",
    "Serilog.Extensions.Logging": "1.2.0",
    "Serilog.Sinks.Literate": "2.0.0",
    "Serilog.Sinks.RollingFile": "3.2.0",
    "UploadFramework": "1.0.0-*",
    "WindowsAzure.Storage": "7.2.1"
  },

  "tools": {
    "BundlerMinifier.Core": "2.0.238",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
    "Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "imports": [
        "portable-net45+win8"
      ]
    }
  },

  "frameworks": {
    "net46": {
      "frameworkAssemblies": {
        "System.IO.Compression": "4.0.0.0"
      },
      "dependencies": {
      }
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

I’d appreciate help in getting me back to my paying work 😃. Also advice on how to diagnose this kind of problem in the future (other than never, ever, ever offering to test things 😃).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:22 (4 by maintainers)

github_iconTop GitHub Comments

14reactions
pranavkmcommented, Nov 17, 2016

You might have stray binaries \ app.config in your bin directory. Does wiping the bin directory and rebuilding work?

6reactions
hikalkancommented, Nov 30, 2016

I had the similar problem for Microsoft.AspNetCore.Http.Features package and I fixed it by adding assembly redirect into app.config:

     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
         <assemblyIdentity name="Microsoft.AspNetCore.Http.Features" publicKeyToken="adb9793829ddae60" culture="neutral" />
         <bindingRedirect oldVersion="1.0.0.0" newVersion="1.1.0.0" />
       </dependentAssembly>
     </assemblyBinding>

Alternatively I resolved this problem by removing Microsoft.VisualStudio.Web.BrowserLink.Loader v14.1.0 package (which depends on Microsoft.AspNetCore.Http.Features). But I didn’t want that since I want browser link feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not load file or assembly 'Microsoft.AspNetCore. ...
This ASP.NET Core 2.1 Project runs fine on my Mac OS. However it throws this exception when I run it from Windows PC....
Read more >
Could not load file or assembly 'Microsoft.AspNet. ...
My project has the following structure: BLL.Net Framework (classic) library. It uses Microsoft.AspNet.SessionState.SessionStateModule NuGet ...
Read more >
Could not load file or assembly 'Microsoft.AspNet. ...
I deployed the following apps: ASP.NET MVC (.Net Framework 4.7.2) site .Net Core 3.1 web API both on the same IIS server.
Read more >
NET Core Hosting Bundle
NET Core Hosting bundle is an installer for the .NET Core Runtime and the ASP.NET Core Module. The bundle allows ASP.NET Core apps...
Read more >
Switching to .NET 6 from .NET 5 results in "This page isn't ...
Hello, I have an MVC application that works fine on .NET 5. I have just switched Target Framework to .NET 6 and now...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found