title: How do I extend the Timeout in SolrConnection? (SolrConnectionException: The operation has timed out)
body: <p>How do I extend/modify the timeout value used for the SolrConnection object?  </p>
  
  <p>I have a long-running optimize operation that does not appear to complete within the default connection timeout provided.  The operation I am using is <code>ISolrOperations&lt;?&gt;.Optimize()</code>.  I do not see any options for increasing the timeout using the <code>ISolrOperations</code> object directly.</p>
  
  <p>I am using the <a href="http://code.google.com/p/solrnet/wiki/MultiCoreAccess" rel="nofollow">Castle Windsor</a> IoC container for instantiation in order to have multiple cores.</p>
  
  <p>Here is the full stacktrace:</p>
  
  <pre><code>SolrNet.Exceptions.SolrConnectionException: The operation has timed out ---&gt; System.Net.WebException: The operation has timed out
     at System.Net.HttpWebRequest.GetResponse()
     at HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse() in c:\prg\SolrNet\svn\HttpWebAdapters\Impl\HttpWebRequestAdapter.cs:line 36
     at SolrNet.Impl.SolrConnection.GetResponse(IHttpWebRequest request) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrConnection.cs:line 201
     at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrConnection.cs:line 113
     --- End of inner exception stack trace ---
     at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrConnection.cs:line 121
     at SolrNet.Impl.SolrConnection.Post(String relativeUrl, String s) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrConnection.cs:line 87
     at SolrNet.Commands.OptimizeCommand.Execute(ISolrConnection connection) in c:\prg\SolrNet\svn\SolrNet\Commands\OptimizeCommand.cs:line 76
     at SolrNet.Impl.SolrBasicServer`1.Send(ISolrCommand cmd) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 96
     at SolrNet.Impl.SolrBasicServer`1.SendAndParseHeader(ISolrCommand cmd) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 106
     at SolrNet.Impl.SolrBasicServer`1.Optimize(CommitOptions options) in c:\prg\SolrNet\svn\SolrNet\Impl\SolrBasicServer.cs:line 69
     at SolrNet.Impl.SolrServer`1.Optimize() in c:\prg\SolrNet\svn\SolrNet\Impl\SolrServer.cs:line 206
     at NationalLaborRelations.SearchAgent.SearchAgentBase.Optimize(ISolrOperations`1 s) in C:\PROJECTS\NLRB\Search\SearchAgent\SearchAgent\SearchAgentBase.cs:line 354
  </code></pre>
  
  <p>Note that the optimization does happen successfully, but that SolrNet does not wait for it to complete before throwing this error.</p>