This project has moved. For the latest updates, please go here.

Self hosted OWIN and urlacl

May 20, 2013 at 4:33 AM
I've created a self hosted Nancy/SignalR application self-hosted in OWIN using Microsoft.Owin.Host.HttpListener and Microsoft.Owin.Hosting

Things work perfectly fine locally but as soon as I try to use anything but localhost to access the app I get a HTTP Error 503. The service is unavailable error. I can't even access the app using 127.0.0.1 or the machine name.

I've tried adding the port to urlacl using

http add urlacl http://*:8989/ user=EVERYONE but doesn't seem to do anything.
Coordinator
May 20, 2013 at 4:38 PM
Can you show your WebApp.Start call?

Does WebApp.Start throw an exception? If it doesn't, then your urlacl is probably right (or you're running as admin).
May 20, 2013 at 6:45 PM
this is the code that wires up OWIN
https://github.com/NzbDrone/NzbDrone/blob/vnext/NzbDrone/Owin/OwinHostController.cs

we get no exception, things work normally when hit using localhost. also yes, we are running as Admin.
Coordinator
May 21, 2013 at 2:12 AM
Your code is only listening on http://localhost:{port}/
            var options = new StartOptions
                {
                    App = GetType().AssemblyQualifiedName,
                    Port = _configFileProvider.Port
                };

            _host = WebApplication.Start(options, BuildApp);
You need to use the url/urls property instead. Pass it the same url you put into the urlacl.
May 21, 2013 at 2:54 AM
Thanks alot,

Changing the start options to the code below fixed the problem. now the app is accessible across the network.
   var options = new StartOptions
    {
        Url = "http://*:8989",
        App = GetType().AssemblyQualifiedName
    };