title: SolrNet Autofac - Use SolrPostConnection
body: <p>I'm using <code>SolrNet</code> with <code>Autofac</code> DI in my web application like this:</p>
  
  <pre><code>var solrNetModule = new SolrNetModule(ConfigurationManager.ConnectionStrings["solr"].ConnectionString);
  solrNetModule.HttpWebRequestFactory = new BasicAuthHttpWebRequestFactory("****", "****");
  builder.RegisterModule(solrNetModule);
  </code></pre>
  
  <p>My queries are quite long and sometimes end up with a 404 in Jetty, I'm pretty sure this happens because the length of the URL.</p>
  
  <p>I've been reading about the <a href="https://github.com/SolrNet/SolrNet/blob/master/SolrNet/Impl/SolrPostConnection.cs" rel="nofollow noreferrer"><code>SolrPostConnection</code></a> and that sounds like a proper solution to my problem, but I'm having trouble implementing it in my <code>Autofac</code> setup.</p>
  
  <p>I know the <code>Autofac</code> <code>SolrNetModule</code> integration internally uses</p>
  
  <pre><code>builder.RegisterInstance(solrConnectionInstance).As&lt;ISolrConnection&gt;();
  </code></pre>
  
  <p>But I can't figure out how to override it or <code>.Register</code> <code>Autofac</code> to use the <code>SolrPostConnection</code> instead.</p>