Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What URL does OWIN understand for ipv6 self-hosting?

My application uses self-hosting feature of ASP.NET Web API. NuGet package name I use is Microsoft.AspNet.WebApi.SelfHost. I used following example as a base.

Following code works for me to launch host on ipv4 localhost endpoint:

WebApp.Start<Startup>("http://127.0.0.1:43666");

What do I enter if I want to specify ipv6 address? "http://[::1]:43666" does not work. Exception thrown is [reformatted]:

System.Net.HttpListenerException: The network location cannot be reached. For information
   ..about network troubleshooting, see Windows Help
at System.Net.HttpListener.AddAllPrefixes()
at System.Net.HttpListener.Start()
at Microsoft.Owin.Host.HttpListener.OwinHttpListener.Start(HttpListener listener, 
   ..Func`2 appFunc, IList`1 addresses, IDictionary`2 capabilities, Func`2 loggerFactory)
at Microsoft.Owin.Host.HttpListener.OwinServerFactory.Create(Func`2 app, 
   ..IDictionary`2 properties)

Judging by my inspection of code in reflector, the HttpAddUrlToUrlGroup function returned error code 1232

like image 967
galets Avatar asked Sep 09 '13 21:09

galets


People also ask

What is Owin self hosting?

Open Web Interface for . NET (OWIN) defines an abstraction between . NET web servers and web applications. OWIN decouples the web application from the server, which makes OWIN ideal for self-hosting a web application in your own process, outside of IIS.


1 Answers

I did not find a solution, however following is a workaround, although it will start server on all addresses, including non-local and ipv4:

WebApp.Start<Startup>("http://+:43666");

Since this question didn't generate any interest I'm closing it

like image 69
galets Avatar answered Oct 07 '22 09:10

galets