Microsoft.Owin 2.0.2.0 conflict when I installed 3.0.0.0

another question arises here, similar to the conflict between SignalR 2.0.2 and Owin 2.0.0 . If I run the project as a console application, I'm fine. Otherwise, as a class library, if I ran it from the command line, I received this error from IIS Express, saying:

Could not load file or assembly 'Microsoft.Owin, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 

But this cannot be, since I installed 3.0.0.0 and in the configuration file I have:

  <?xml version="1.0" encoding="utf-8"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration> 

Here is the rest of the application:

  namespace katanaIntro { using AppFunc = Func<IDictionary<string, object>, Task>; public class Startup { public void Configuration(IAppBuilder app) { app.Use(async (environment, next) => { Console.WriteLine("Requestion : " + environment.Request.Path); await next(); Console.WriteLine("Response : " + environment.Response.StatusCode); }); ConfigureWebApi(app); app.UseHelloWorld(); } private void ConfigureWebApi(IAppBuilder app) { var config = new HttpConfiguration(); config.Routes.MapHttpRoute( "DefaultApi", "api/{controller}/{id}", new { id = RouteParameter.Optional }); app.UseWebApi(config); // <-- It works without this!!! } } public static class AppBuilderExtensions { public static void UseHelloWorld(this IAppBuilder app) { app.Use<HelloWorldComponent>(); } } public class HelloWorldComponent { AppFunc _next; public HelloWorldComponent(AppFunc next) { _next = next; } public Task Invoke(IDictionary<string, object> environment) { var response = environment["owin.ResponseBody"] as Stream; using (var writer = new StreamWriter(response)) { return writer.WriteAsync("Hello!!!"); } } } } 

Here is the command from the command line:

  "c:\Program Files\IIS Express\iisexpress.exe" /path:"C:\Users\smagistri\Projects\Lab 4.5\katanaIntro\katanaIntro" 

I forgot to mention that it works only if I delete ConfigureWebApi (application);

Any ideas?

+7
c # iis-express owin
source share
4 answers

I only need to rename App.config to Web.config or make a copy of it and call it Web.config, and it works.

+37
source share

Try to run

cmd Command:

 "%ProgramFiles%\IIS Express\iisexpress.exe" -path:"c:\Users\pci40\Documents\Visual Studio 2012\Projects\KatanaInfo \KatanaInfo 

and rename Appconfig to WebConfig

0
source share

Go to the Refrences project and find Microsoft.Owin. Right-click on it and check the version for properties.

The build version of the project and below the webconfig newVersion line should be the same.

 <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> 
0
source share

Install the Microsoft.Owin.Security package. This works for me.

PS. Remember to rename the app.config file.

-one
source share

All Articles