无法从.com域连接到远程服务器

时间:2015-08-14 06:30:30

标签: c# asp.net web-services web

我创建了一个Web服务并在本地计算机上进行了测试,它工作正常。所以我在.com域中托管了它。但当我打电话给那个网络服务时,它给了我:

  

无法连接到远程服务器。

所以我也托管了它.in域名。它在.in域中运行良好。

我已尝试使用代理,但仍然出现同样的错误。 我的代码是:

//Call Send SMS API
string sendSMSUri = "http://smsindia.itworldindia.com/sendhttp.php";

//Create HTTPWebrequest
HttpWebRequest httpWReq = (HttpWebRequest)WebRequest.Create(sendSMSUri);
httpWReq.Proxy = new System.Net.WebProxy(sendSMSUri);
//Prepare and Add URL Encoded data
UTF8Encoding encoding = new UTF8Encoding();
byte[] data = encoding.GetBytes(sbPostData.ToString());
//Specify post method
httpWReq.Method = "POST";
httpWReq.ContentType = "application/x-www-form-urlencoded";
httpWReq.ContentLength = data.Length;
using (Stream stream = httpWReq.GetRequestStream())
{
    stream.Write(data, 0, data.Length);
}

//Get the response
HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string responseString = reader.ReadToEnd();
//Close the response
reader.Close();
response.Close();

有人可以帮我解决这个问题吗?

0 个答案:

没有答案