StreamSocketListener 和本地主机 [英] StreamSocketListener and localhost

查看:24
本文介绍了StreamSocketListener 和本地主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码在我的通用 8.1 应用程序上设置 StreamSocketListener:

I'm using the following code to set up a StreamSocketListener on my universal 8.1 app:

_listener = new StreamSocketListener();
_listener.Control.QualityOfService = SocketQualityOfService.Normal;
_listener.ConnectionReceived += OnConnectionReceived;
await _listener.BindServiceNameAsync("8776");

这运行没有任何问题,但是当我尝试 &浏览到http://localhost:8776(或直接通过ip地址或机器名),请求超时.

This runs without any problems, however when I try & browse to http://localhost:8776 (or directly via ip address or machine name), the request times out.

在 netstat 中我可以看到 8776 端口是开放的 &听着,我启用了环回豁免,禁用了我的防火墙,但我仍然无法连接.这适用于 Windows 8.1 和 Windows Phone 8.1 应用.

In netstat I can see the 8776 port is open & listening, I've enabled loopback exemption, disabled my firewall, but I'm still not able to connect. This is true for both the Windows 8.1 and the Windows Phone 8.1 app.

当我尝试从另一台机器连接时,它可以正常工作.是否有任何设置/配置我可以使用以便我能够从同一台机器连接?

When I try to connect from another machine, it works without problems. Is there any setting/configuration I can use so I'm able to connect from the same machine?

推荐答案

Windows RT 阻止两个 WinRT 应用程序之间的环回访问.

Windows RT blocks loopback access between two WinRT applications.

使用 IP 环回地址的网络通信不能用于Windows 中的进程间通信(两个不同的应用程序之间)运行时应用程序,因为这受到网络隔离的限制.网络应用程序内允许使用 IP 环回地址进行通信在同一进程内用于通信目的.

Network communications using an IP loopback address cannot be used for interprocess communication (between two different apps) in a Windows Runtime app since this is restricted by network isolation. Network communication using an IP loopback address is allowed within an app within the same process for communication purposes.

更多信息和解决方法此处

这篇关于StreamSocketListener 和本地主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆