What URL does OWIN understand for ipv6 self-hosting?
Asked Answered
B

2

12

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

Bon answered 9/9, 2013 at 21:35 Comment(3)
This seems to work for me. Are you getting any exceptions. If so could you post the exception message here?Vaudois
Can you check if you have disabled IPV6 on this computer? I see many articles to help disable IPv6. you can use that to see if you have done that. Example : techunboxed.com/2012/08/how-to-disable-ipv6-in-windows-8.htmlVaudois
@Praburaj: D:\>ping ::1 Pinging ::1 with 32 bytes of data: Reply from ::1: time<1ms Reply from ::1: time<1msBon
B
10

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

Bon answered 14/10, 2013 at 15:3 Comment(0)
P
0

had the same problem and it seemed to be the Account under which the service was running. Need to make sure it's running under NetworkService - both localhost and other variations of URLs should work then :)

Pirouette answered 21/7, 2016 at 14:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.