Wednesday, February 3, 2016

Access web service problem under VS2005 ppc simulator, experts advise




            


Server program Service.cs:
[WebMethod]
public string HelloWorld ()
{
return "Hello World";
}

PPC emulator client program as follows:
private void button1_Click (object sender, EventArgs e)
{
try
{
WebDevClientlocalhost.Service sw = new WebSerDeviceClient.WebDevClientlocalhost.Service ();
sw.Url = "http://127.0.0.1/webservicetest2/Service.asmx";
MessageBox.Show (sw.HelloWorld ());
}
catch (Exception ee)
{
MessageBox.Show (ee.Message);
}

ActiveSync connection settings "Auto"

I use PPC emulator IE browser, enter http://127.0.0.1/webservicetest2/Service.asmx can get the right result, but I debug in VS2005 environment, errors Unable to connect to the remote server

At the same time, I created a windows program call web service procedure is as follows:
private void button1_Click (object sender, EventArgs e)
{
webclientlocalhost.Service sw = new WebserviceClient.webclientlocalhost.Service ();
sw.Url = "http://127.0.0.1/webservicetest2/Service.asmx";
MessageBox.Show (sw.HelloWorld ());
}
You can get the right result, experts advise, thank you
Reply:
Please help experts, cards a day, try a good variety of methods
Reply:
sw.Url = "http://127.0.0.1/webservicetest2/Service.asmx";

The 127.0.0.1 to your machine name, do not use 127.0.0.1 or localhost.
Reply:
Change the machine name, error "Could not establish connection to network", but I opened the ipconfig, find my machine IP192.168.105.114 in LAN's (IP automatically assigned), the test is successful, do not know why?
Reply:
Read some relevant examples, found behind the link URL client examples are related to the upper end of the slogan, ask me to see how the port number? I now use the program
sw.Url = "http://192.168.105.114/webservicetest2/Service.asmx";
Client can successfully access service
IIS web service onExamples of the URL
http: // zhubaobao: 1100 / WebSite1 / Service.asmx
May I ask how to view the port number?
Reply:
up
Reply:
The port number is selected when the construction project is the file system location instead of http brought, VS automatically configure the port number, if installed IIS, choose http, generally there will be no port number. On the PC, you can see directly debug port number in the address bar of the web

No comments:

Post a Comment