get ipaddr but error
-
2012年3月4日 11:00Through the following method to obtain the machine Internet IP
address.
But sometimes successfully, sometimes fail.
1: Web Service
[WebMethod]
Public string GetIp ()
{
String IP = Context.Request.UserHostAddress;
Return IP.
}
2: in the web service client references
Try
{
WsService1 = new com.mysite.www.WebService1 ();
Label2.Text = wsService1.GetIp ();
}
Catch (Exception Ex)
{
String sEX = ex.ToString ();
MessageBox.Show ("Please connect Internet!");
}
Sometimes successfully, sometimes return error HTM markers.I do not know
how to solve.Thank you.
全部回复
-
2012年3月4日 19:08版主
The "HTM markers" are probably a detailed error message that happens to be in HTML. Try to capture that message, perhaps by using Fiddler, and then see what it's trying to tell you.John Saunders
WCF is Web Services. They are not two separate things.
Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
Use File->New Project to create Web Service Projects- 已标记为答案 VCResearch 2012年3月6日 7:24

