0

I try to mount a web api application hosted by Owinhost.exe

when launching I got this error message:

Error: System.ArgumentException 
 No conversion available between System.Func2[System.Collections.Generic.IDictionary2[System.String,System.Object],System.Threading.Tasks.Task] and Microsoft.Owin.OwinMiddleware. 
 Parameter name: signature 

My Library project declares this:

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        HttpConfiguration config = new HttpConfiguration();
        config.Routes.MapHttpRoute(
        "Default",
        "{controller}/{id}",
        new { id = RouteParameter.Optional });
       app.UseWebApi(config);
     }
}

My package is this one:

<packages>
  <package id="Microsoft.AspNet.WebApi.Client" version="5.1.2" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.1.2" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Owin" version="5.1.2" targetFramework="net45" />
  <package id="Microsoft.Owin" version="2.1.0" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" />
  <package id="Owin" version="1.0" targetFramework="net45" />
</packages>

Does anybody have an idea?

xav
  • 5,452
  • 7
  • 48
  • 57

1 Answers1

0

The reason for the error is that OwinHost looks for binding redirects in a web.config file at the project root. As a workaround, place a web.config file at the current directory (one level above the bin folder), then place the following redirect in it:

<?xml version="1.0"?>
  <configuration>
  <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>
</assemblyBinding>

Here is a link to the issue on the Web API CodePlex site: https://aspnetwebstack.codeplex.com/workitem/2116

Cheers, Tony

Anthony Sneed
  • 703
  • 6
  • 19