Andrey Korneyev
Andrey Korneyev

Reputation: 495

Microsoft.Owin.Host.SystemWeb results in Could not load file or assembly 'System.Runtime

I have a .Net Framework 4.7.1 web application project.

When I add the NuGet package Microsoft.Owin.Host.SystemWeb, my project fails to start, giving me the following error:

Could not load file or assembly 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

It happens right after I add the above-mentioned package. Without it everything works perfectly fine.

Any ideas?

I have Visual Studio 2017 15.5.5. Maybe it's some version conflict problem? I also have Microsoft.AspNet.Identity.Core and Microsogt.AspNet.Identity.EntityFramework packages installed.

Upvotes: 2

Views: 1144

Answers (2)

Vishal Patwardhan
Vishal Patwardhan

Reputation: 317

I removed element with tag bindingredirect in web.config and it resolved the issue. Please refer the following post https://learn.microsoft.com/en-us/answers/questions/902363/cannot-load-file-or-assembly-system-runtime

Upvotes: 0

Sonal Borkar
Sonal Borkar

Reputation: 561

Though a delayed reply. Still posting if anyone else having same issue.

Add below key in appSettings section in web.config file

<add key="owin:appStartup" value="<<Namespace>>.Startup, <<Assembly>>" />

for e.g.

<add key="owin:appStartup" value="<<Namespace>>.Startup, <<Assembly>>" />

or, only Startup class with Namespace and without Assembly

<add key="owin:appStartup" value="<<Namespace>>.Startup" />

Upvotes: 0

Related Questions