Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR self hosting on Windows Service

I'm wrote a small POC application (console application) on C# (vs2013) that makes: host and clients.

The code of the host side:

string url = "http://*:8900/";

using (WebApp.Start(url))
{
    Console.WriteLine("Server running at " + url);
    lock (just4lock)
        Monitor.Wait(just4lock);
}

It's working only if I'm run my (console) application with "Run as administrator".

Ok, now I'm want to move this code to my Windows Service application. When i'm running the same host code on windows service, I'm getting this error:

An unhandled exception of type 'System.MissingMemberException' occurred in Microsoft.Owin.Hosting.dll

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

My service run as "Local System account". I'm not see any option to make it's "run as administrator".

Do you know a way to make SignalR self-hosting works without administrator?

How I'm can make this windows service run as administrator?

Thanks!

like image 233
No1Lives4Ever Avatar asked Jan 16 '14 20:01

No1Lives4Ever


1 Answers

I had the same problem, and the solution for me was just to add a reference to the assembly Microsoft.Owin.Host.HttpListener to my project.

like image 150
JulienVan Avatar answered Oct 05 '22 07:10

JulienVan