I do not have IIS, I use my localhost that comes with Visual Studio, I am not sure how to make a service call work if I am using localhost. It tells me “Unable to connect to remote server” , Is there a way I can make a webservice call work using localhost?. Here is my code:
public void CallService()
{
WebRequest requestweb = WebRequest.Create("http://localhost/WebServices/MyTestService/HelloWorld");
requestweb.Method = "GET";
//Line below returns "Unable to connect to remote server"
WebResponse response = requestweb.GetResponse();
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
Stream data = response.GetResponseStream();
response.Close();
}
Would truly appreciate an advice on this. Thank you
Open the website you’re trying to connect to in your favorite web browser. Copy the value from your location bar and paste it as the parameter to
WebRequest.Create.