无法从Pocket PC模拟器连接到Web服务 [英] unable to connect to web service from pocket pc emulator
问题描述
我正在尝试通过Pocket PC Phone Emulator调用在本地主机中运行的Web服务,并将其拥抱到活动同步中
以下是我的Web服务的网址
http://localhost:1043/VLR/Service.asmx
在设备程序中,我写了
Hi,
I am trying to call a web service running in localhost through pocket PC phone Emulator.I cradled it to active sync
The following is URL of my web service
http://localhost:1043/VLR/Service.asmx
In device program i wrote
private void Form1_Load(object sender, EventArgs e)
{
localhost.Service ls = new localhost.Service();
string a = ls.authenticate("adssad","fssfd", "dsada");
MessageBox.Show(a);
}
身份验证是我在Web服务中定义的方法.
以下是我执行时的错误
Where authenticate is a method i defined in my web service.
The following are the error when i execute
System.Net.WebException was unhandled
Message="Could not establish connection to network."
StackTrace:
at System.Net.HttpWebRequest.finishGetResponse()
at System.Net.HttpWebRequest.GetResponse()
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse()
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse()
at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke()
at DeviceApplication2.localhost.Service.authenticate()
at DeviceApplication2.Form1.Form1_Load()
at System.Windows.Forms.Form.OnLoad()
at System.Windows.Forms.Form._SetVisibleNotify()
at System.Windows.Forms.Control.set_Visible()
at System.Windows.Forms.Application.Run()
at DeviceApplication2.Program.Main()
我用127.0.0.1替换了localhost.如果我输入原始IP地址,则无法加载Web服务.有什么办法吗?
I replaced localhost with 127.0.0.1. If i put my original IP address, the web service could not be loaded. Is there any way out ?
推荐答案
模拟器伪装成一个单独的设备. Localhost(127.0.0.1)将仅在您的主机上工作.尝试改用您计算机的IP地址.
The emulator pretends to be a separate device. Localhost (127.0.0.1) will only work on your host computer. Try using the IP address of your computer instead.
这篇关于无法从Pocket PC模拟器连接到Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!