I have an IIS server which serves a search page using SolrNet. The search index is Solr, running inside Tomcat, on a separate machine on the same subnet (in the same room).
I get intermittent connection errors from IIS to the search server, mainly (InnerException):
Error: The operation has timed out
In: System.Net.WebResponse GetResponse()
Stack Trace: at System.Net.HttpWebRequest.GetResponse()
at HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse()
As well as sometimes (InnerException):
Error: Unable to connect to the remote server
In: System.Net.WebResponse GetResponse()
Stack Trace: at System.Net.HttpWebRequest.GetResponse()
I believe the problem is that IIS only ever has two concurrent connections to Tomcat (which I can see using CurPorts), so eventually the calls get so backed up it times out, but I can't work out why. My preview site, on the same server, is able to create more connections, but increasing the setting using this code in web.config makes no difference:
<connectionManagement>
<add address="*" maxconnection="100"/>
</connectionManagement>
I have already increased the SolrNet timeout to 30s using:
SolrNet.Startup.Init<SolrDataObject>(new SolrNet.Impl.SolrConnection(System.Configuration.ConfigurationManager.AppSettings["SolrURL"]) { Timeout = 30000 });
I first asked this question about these same errors - I have since found out that there are only ever two connections from IIS to Tomcat, and this seems a very likely cause for this problem to me.
This was because the machine.config was apparently locked only for some sites in IIS - though I'm not sure how that happened, changing the machine.config fixed this problem.
(This didn't fix the underlying problem, but I'll update that now)