【发布时间】:2013-09-13 11:36:44
【问题描述】:
我的应用程序使用ASP.NET Web API 的自托管功能。我使用的 NuGet 包名称是 Microsoft.AspNet.WebApi.SelfHost。我使用following example 作为基础。
以下代码适用于我在 ipv4 localhost 端点上启动主机:
WebApp.Start<Startup>("http://127.0.0.1:43666");
如果我想指定ipv6地址,我应该输入什么? “http://[::1]:43666”不起作用。抛出的异常是[重新格式化]:
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)
根据我检查反射器中的代码判断,HttpAddUrlToUrlGroup 函数返回错误代码 1232
【问题讨论】:
-
这似乎对我有用。你有任何例外。如果是这样,您可以在此处发布异常消息吗?
-
您能否检查一下您是否在这台计算机上禁用了 IPV6?我看到很多帮助禁用 IPv6 的文章。你可以用它来看看你是否已经这样做了。示例:techunboxed.com/2012/08/how-to-disable-ipv6-in-windows-8.html
-
@Praburaj:
D:\>ping ::1 Pinging ::1 with 32 bytes of data: Reply from ::1: time<1ms Reply from ::1: time<1ms
标签: asp.net self-hosting owin