【问题标题】:What URL does OWIN understand for ipv6 self-hosting?OWIN 理解 ipv6 自托管的 URL 是什么?
【发布时间】: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:\&gt;ping ::1 Pinging ::1 with 32 bytes of data: Reply from ::1: time&lt;1ms Reply from ::1: time&lt;1ms

标签: asp.net self-hosting owin


【解决方案1】:

有同样的问题,它似乎是运行服务的帐户。需要确保它在 NetworkService 下运行 - localhost 和其他 URL 变体都应该可以工作:)

【讨论】:

    【解决方案2】:

    我没有找到解决方案,但是以下是一种解决方法,尽管它会在所有地址上启动服务器,包括非本地和 ipv4:

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

    由于这个问题没有引起任何兴趣,我将关闭它

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-11
      • 1970-01-01
      • 2019-03-02
      相关资源
      最近更新 更多