title: RavenDB connection issues
body: <p>We have seen a noticeable uptick in problems related to RavenDB connections. We're using the IIS server connection method.</p>
  
  <p>I've checked the index errors and I don't see anything listed.</p>
  
  <p>This server is replicated with a MySQL server and there is one error related to replication in the log from today. Could the client stack trace errors actually be coming from the replicated server and not Raven?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The client in this case is a single job that runs a few hundred times a day...succeeding many of those times but increasing in failures due to these errors.</p>
  
  <blockquote>
    <p>Sql Replication failure to replication</p>
  </blockquote>
  
  <p>Here are the partial stack trace errors from the client log:</p>
  
  <pre><code>[WebException: Unable to connect to the remote server]
  System.Net.HttpWebRequest.GetRequestStream(TransportContext&amp; context):367
  System.Net.HttpWebRequest.GetRequestStream():3
  Raven.Abstractions.Connection.HttpRequestHelper.WriteDataToRequest(HttpWebRequest req, String data, Boolean disableCompression):7
  Raven.Client.Connection.ServerClient.DirectBatch(IEnumerable`1 commandDatas, String operationUrl):171
  Raven.Client.Connection.ReplicationInformer.TryOperation[T](Func`2 operation, String operationUrl, Boolean avoidThrowing, T&amp; result, Boolean&amp; wasTimeout):35
  Raven.Client.Connection.ReplicationInformer.ExecuteWithReplication[T](String method, String primaryUrl, Int32 currentRequest, Int32 currentReadStripingBase, Func`2 operation):169
  Raven.Client.Connection.ServerClient.ExecuteWithReplication[T](String method, Func`2 operation):33
  Raven.Client.Document.DocumentSession.SaveChanges():65
  </code></pre>
  
  <p>and</p>
  
  <pre><code>[WebException: Unable to connect to the remote server]
  System.Net.HttpWebRequest.GetResponse():570
  Raven.Client.Connection.HttpJsonRequest.ReadJsonInternal(Func`1 getResponse):45
  Raven.Client.Connection.HttpJsonRequest.ReadResponseJson():206
  Raven.Client.Connection.ServerClient.DirectGet(String[] ids, String operationUrl, String[] includes, String transformer, Dictionary`2 queryInputs, Boolean metadataOnly):631
  Raven.Client.Connection.ServerClient+&lt;&gt;c__DisplayClass77.&lt;Get&gt;b__76(String u):51
  Raven.Client.Connection.ReplicationInformer.TryOperation[T](Func`2 operation, String operationUrl, Boolean avoidThrowing, T&amp; result, Boolean&amp; wasTimeout):35
  Raven.Client.Connection.ReplicationInformer.ExecuteWithReplication[T](String method, String primaryUrl, Int32 currentRequest, Int32 currentReadStripingBase, Func`2 operation):169
  Raven.Client.Connection.ServerClient.ExecuteWithReplication[T](String method, Func`2 operation):33
  Raven.Client.Document.HiLoKeyGenerator.GetDocument(IDatabaseCommands databaseCommands):41
  Raven.Client.Document.HiLoKeyGenerator.GetNextRange(IDatabaseCommands databaseCommands):109
  Raven.Client.Document.HiLoKeyGenerator.NextId(IDatabaseCommands commands):58
  Raven.Client.Document.HiLoKeyGenerator.GenerateDocumentKey(IDatabaseCommands databaseCommands, DocumentConvention convention, Object entity):9
  Raven.Client.Document.MultiTypeHiLoKeyGenerator.GenerateDocumentKey(IDatabaseCommands databaseCommands, DocumentConvention conventions, Object entity):174
  Raven.Client.Document.DocumentStore+&lt;&gt;c__DisplayClass4.&lt;Initialize&gt;b__2(String dbName, IDatabaseCommands databaseCommands, Object entity):20
  Raven.Client.Document.DocumentConvention.GenerateDocumentKey(String dbName, IDatabaseCommands databaseCommands, Object entity):164
  Raven.Client.Document.GenerateEntityIdOnTheClient.GenerateDocumentKeyForStorage(Object entity):46
  Raven.Client.Document.InMemoryDocumentSessionOperations.StoreInternal(Object entity, Etag etag, String id, Boolean forceConcurrencyCheck):79
  Raven.Client.Document.InMemoryDocumentSessionOperations.Store(Object entity):23
  </code></pre>