我正在尝试运行How to create and use a TCP socket client app for Windows Phone,但会收到以下错误...
An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll and wasn't handled before a managed/native boundary
我的开发计算机上运行了简单IP服务,调试时手机通过USB连接。它没有在文章中建议你应该使用什么IP地址从电话到达开发计算机 - 我试过了,
192.168.1.66 // Dev computer address on lan
whitby // Dev computer name
127.0.0.1 // Localhost, refers to dev computer or phone?
localhost // ditto
我也在猜测,如果主机错了,我会得到一条很好的错误信息 - 相反,没有任何内容(即空字符串)从e.SocketError.ToString()
回显
我使用的是Windows Phone 8。
答案 0 :(得分:0)
实际上,我已经弄明白了。我习惯了Windows Phone 7编程,看起来系统库在Windows Phone 8中当然会抛出异常 - 应用程序继续运行。
问题是防火墙阻止了简单IP服务端口。要开始工作,您可以暂时禁用Windows防火墙:
然后使用开发计算机的IP连接,例如192.168.1.66(不是localhost,127.0.0.1等)