The server factory could not be located for the given input: Microsoft.Owin.Host.HttpListener

31,687

Solution 1

The Microsoft.Owin.Host.HttpListener assembly is a runtime reference in WebApp.Start. You need to include it in the project's references for it to be available for loading. Check the bin\Debug (etc) directory to make sure it's included. May as well add it as a nuget dependency as well.

Solution 2

Install the package:

PM> Install-Package Microsoft.Owin.Host.HttpListener

Solution 3

Install the Microsoft.Owin.Host.HttpListener package from Nuget using:

PM> Install-Package Microsoft.Owin.Host.HttpListener

(unlike an earlier answer you should avoid using -IncludePrerelease in production code)

Share:
31,687
jignesh
Author by

jignesh

Asp.Net C# SQL Server Jquery Javascript Signalr WCF Silverlight MVC WebAPI Android & IOS App

Updated on July 05, 2022

Comments

  • jignesh
    jignesh almost 2 years

    I have implemente signalR in window service.

    private IDisposable SignalR { get; set; }
    
    public void Configuration(IAppBuilder app)
    {   
            var hubconfig=new Microsoft.AspNet.SignalR.HubConfiguration();
            hubconfig.EnableJSONP = true;
    
            app.UseCors(CorsOptions.AllowAll);
            app.MapSignalR(hubconfig);
    }
    
    
    private void StartSignalRServer(StringBuilder sbLog)
    {
            try
            {
                this.SignalR = WebApp.Start(ServerURI); //This throws exception
    
                //this.SignalR= WebApp.Start<Startup>(ServerURI);
                sbLog.Append(string.Format("{0}--------SignalR Server Started------",Environment.NewLine));
            }
            catch (Exception ex)
            {
                sbLog.Append(string.Format("{0}Exception in StartSignalRServer=>{1}", Environment.NewLine,ex.Message));
            }
    }
    

    Exception:The server factory could not be located for the given input: Microsoft.Owin.Host.HttpListener

  • EKW
    EKW over 6 years
    Note that, for the copy-pasters, you shouldn't be using IncludePrerelease unless you WANT untested code in your app.
  • Johann67
    Johann67 over 5 years
    You need to add reference to the HttpListener in the "StartUp Project". So, be carefull if you use WebApp.Start in another project.