In my ASP.NET 2.0 web service I am trying to access Google API to translate some texts. Following code does this right :
string result = "";
// create the web request to the Google Translate REST interface
System.Net.WebRequest oRequest = System.Net.WebRequest.Create("http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q="
+ System.Web.HttpUtility.UrlEncode("Text to translate") + "&langpair=" + "en" + "%7C" + "fr");
// make the web call
System.Net.WebResponse oResponse = oRequest.GetResponse();
// grab the response stream
System.IO.StreamReader oReader = new System.IO.StreamReader(oResponse.GetResponseStream());
// put the whole response in a string
string sContent = oReader.ReadToEnd();
// parse the string into the litJSON simple object model
JsonData oData = JsonMapper.ToObject(sContent);
// write out the translated text
result = oData["responseData"]["translatedText"].ToString();
(JsonData is from the DLL LitJson --> http://litjson.sourceforge.net)
This works just fine as long as I am on the ASP.NET development server. But as soon as I put my Web service to my IIS 6.0 server, I get "The operation has timed out" errors in my client.
With a System.Net.WebClient I get the same timeout.
Is there any setting on IIS that forbids web requests ?