“Access Denied” exception in self hosted Owin application

These weeks at the company I work for I’m building an Identity Server using Thinktecture’s IdentityServer3. I set up all of the custom stores and managers for users and roles, built the solution and debugged it. After the successful configuration of the IdentityServer settings, the program threw this exception:

"Access Denied" 
in System.Net.HttpListener.AddAllPrefixes()
 in System.Net.HttpListener.Start()
 in Microsoft.Owin.Host.HttpListener.OwinHttpListener.Start(HttpListener listener, Func`2 appFunc, IList`1 addresses, IDictionary`2 capabilities, Func`2 loggerFactory)
 in Microsoft.Owin.Host.HttpListener.OwinServerFactory.Create(Func`2 app, IDictionary`2 properties)

This is the portion of the program that threw the exception:

using (WebApp.Start("https://identity.local/"))
{
    Console.WriteLine("Identity Server Running.");
    Console.ReadLine();
}

The solution was extremely simple. I just add to add a urlacl rule in Windows’s netsh to enable my code to listen for a secure connection on that address.

netsh http> add urlacl url=https://identity.local:443/ user=Everyone
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s