One thought ...
Hi,
Is there any reason why when I run the sample from the search SDK on my personal server at home it works perfectly fine, yet when I load the same code to my hosted server I get an error message saying that the service did not repond correctly?
(System.Net.WebException: Unable to connect to the remote server > System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) End of inner exception stack trace at System.Net.HttpWebRequest.GetRequestStream() at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at com.msn.search.soap.MSNSearchService.Search(SearchRequest Request) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\da57b35a\195329d3\App_WebReferences.e3jjpxdh.0.cs:line 47 at ASP.searchproxy_aspx.Page_Load(Object sender, EventArgs e) in e:\kunden\homepages\33\d174594834\searchProxy.aspx:line 57)...
Any thoughts? I'm rather stumped. No code has changed. The only thing that comes to mind is that maybe the hosting server doesn't allow communication via services? I can run services fine, but this is the only code that I have that accesses any services. Any help is greatly appreciated.
"The only thing that comes to mind is that maybe the hosting server doesn't allow communication via services?"
I don't think so.
Have you verified that the code, the files and the directory structure are the same on the local server and the shared hosting server?
me* at 2007-8-31 >

I figured that could be a possibility, but it's very straightforward: everything is in the root directory except the .js files, which is the same setup locally.
/masterpage.master - Holds the search stuff
/searchProxy.aspx - the file called from within the masterpage to display the search results
/scripts/layoutLibrary.js - used for html rendering
/scripts/searchClient.js - the code that does all the XMLHTTPRequest junk
the masterpage and layoutlibrary are unimportant to communications.
heres the searchProxy.aspx file:
(Sorry about the formatting)
<%@ Page Language="C#" AutoEventWireup="true" Debug="true" %>
<%@ Import Namespace="com.msn.search.soap" %>
<%@ Import Namespace="System.Web.Configuration" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="Microsoft.Security.Application" %>
script language="C#" runat="server">
void Page_Load(object sender, EventArgs e) {
try {string key = Request.QueryString["searchKey"];if (!String.IsNullOrEmpty(key)) {
string offset = Request.QueryString["searchOffset"];
string count = Request.QueryString["searchCount"];
CultureInfo ci = new CultureInfo("en-us");
MSNSearchService s = new MSNSearchService();
SearchRequest sr = new SearchRequest();
SourceRequest[] srcr = new SourceRequest[1];
srcr[0] = new SourceRequest();
srcr[0].Source = SourceType.Web;
if (!String.IsNullOrEmpty(count)) {
int iCount = Int32.Parse(count, ci);
if (iCount > 0 && iCount <= 50)
srcr[0].Count = iCount;
else
srcr[0].Count = 10;
}
else
srcr[0].Count = 10;
if (!String.IsNullOrEmpty(offset)) {
int iOffset = Int32.Parse(offset, ci);
if (iOffset > 0 && iOffset <= 250)
srcr[0].Offset = iOffset;
else
srcr[0].Offset = 0;
}
else
srcr[0].Offset = 0;
sr.Requests = srcr;
sr.CultureInfo = "en-us";
sr.Flags = SearchFlags.MarkQueryWords;
sr.Query = Server.UrlDecode(key);
sr.SafeSearch = SafeSearchOptions.Strict;
sr.ApID = WebConfigurationManager.AppSettings.Get("appIDSearch");
SearchResponse srsp = s.Search(sr);
PrintResults(srsp);
}
}
catch (Exception fault) {
Response.Write(fault.ToString());
}
}private void PrintResults(SearchResponse searchResponse)
{
...... nothing important here
}
</script>I do not know why you get this error message, Steve.
You should check your whole concept, the whole deployment and the hosting server.
Call the support of your hosting provider and ask if they have a problem to connect to external ressources.
Add a Web Reference to a Service and test if the server is able to connect.
me* at 2007-8-31 >

Did you configure a proxy in your ASP.Net app?
if not, there are two solutions for you:
1. MSNSearchService s = new MSNSearchService();
WebProxy p = new WebProxy("YourProxy", true);
s.Proxy = p;
2. add Node system.net in your web.config file
<system.net>
<defaultProxy>
<proxy usesystemdefault="false" proxyaddress="YourProxy" bypassonlocal="true"/>
</defaultProxy>
</system.net>
I wish it can help you.
Good luck.