This project has moved and is read-only. For the latest updates, please go here.

OwinHost.exe + WebApi

Mar 13, 2014 at 2:42 AM
Am I supposed to be able to host WebApi in OwinHost.exe? It seems like it should work based on my understanding. However, I see this error when it starts up

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 Code
public class StartupWebApi
    public void Configuration(IAppBuilder app)

        var config = new HttpConfiguration();
        config.Routes.MapHttpRoute(name: "Default API", routeTemplate: "{controller}");

public class HelloWorldController : ApiController
    public string[] Get()
        return new string[] { "Hello", "World", DateTime.Now.ToString() };
I saw some posts about mismatched libraries but all of my own related DLLS and the OwinHost.exe are version 2.1.30113.529 except the Owin.dll itself, which is version 1.0.

Same startup code works fine if hosted in IIS. I'm not really sure how to get around that exception. Any ideas?

Mar 13, 2014 at 3:37 AM
I'd guess you have an old version of Microsoft.Owin.dll (pre v2.0.0-rtw). Can you share your packages.config?
Apr 2, 2014 at 7:37 AM
same code, same issue.

My package:

<?xml version="1.0" encoding="utf-8"?>
<package id="Microsoft.AspNet.WebApi.Client" version="5.1.1" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.1.1" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Owin" version="5.1.1" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.SelfHost" version="5.1.1" 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" />
Apr 2, 2014 at 3:40 PM
That list doesn't include OwinHost.exe. Did you install it separately (from chocolaty)? What version?
Apr 2, 2014 at 6:12 PM
Edited Apr 2, 2014 at 9:22 PM
Yes I installed OwinHost separately with Chocolatey

OwinHost version is 2.1.0

maybe a /version parameter could be welcome

If it's important, Chocolatey est version

I am on Windows 7 and my code a just a small difference, the class is Startup, not StartupWebApi
Aug 23, 2014 at 10:54 AM
See this issue for a solution to the exception.