can not use HTTP GET inside a asp.net web service [WebMethod]
I have a problem using HTTP GET/POST via HttpWebRequest in .Net when that is inside a asp.net web service Could some one help what could be the issue here. The same piece of code works fine from a Windows Form/ Console Application
[WebMethod]
public string someWebMethod()
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("http://www.google.com");
WebResponse resp = request.GetResponse(); <---------This is hanging... any idea how to work around?
.......
}
开发者_如何学JAVA
This is how I made it work, by specifying my default proxy explicitly.
[WebMethod]
public string someWebMethod()
{
HttpWebRequest request =(HttpWebRequest) HttpWebRequest.Create(@"http://www.google.com");
request.Proxy = new WebProxy("10.168.0.17", 8080);
}
精彩评论