Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

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");

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."
    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()

I replaced localhost with If i put my original IP address, the web service could not be loaded. Is there any way out ?
Updated 9-Dec-10 0:20am
Member 9355971 2-Feb-13 3:42am    
error:Could not establish connection to network..
even if i given the i address it isn't working

1 solution

The emulator pretends to be a separate device. Localhost ( will only work on your host computer. Try using the IP address of your computer instead.
Share this answer
Praveen P Nair 10-Dec-10 5:07am    
Thanks. But I tried that. But while adding web reference, i replaced localhost with my IP address. The webservice was not loaded.
[no name] 10-Dec-10 6:05am    
Hmm. Then let's try to find out the right URL in a different way. First try to call the URL of the webservice from your webbrowser. It should display a description of the webmethods. If not, the webservice (or more likely the IIS) may not be configured properly. In that case it is no wonder the emulator can't access it. Once you have found it, you may try to locate it the same way with the browser of the emulator. Then you should know the right URL and can be certain that the webservice really is running.
Praveen P Nair 13-Dec-10 1:33am    
You are right. I created a virtual directory in IIS, placed my web service code in wwwroot directory and when i gave "http://praveen/", OLEDB error message was displayed. I am following the guidelines given by to solve that problem
Praveen P Nair 13-Dec-10 6:16am    
Now when i replace localhost with computer name that is praveen, the web service is loading. But the web exception error still remains the same. When i replace praveen with my IP address, a prompt appears, i gave username and password that i gave while configuring IIS 5.1. But permission denied error is comming :(
Praveen P Nair 29-Jan-11 3:29am    
I tried to connect to a webservice that was running within visual studio environment. Once if that is configured with IIS, the problem is solved. Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900