embedded http server failing

32 views
Skip to first unread message

Ronnie Overby

unread,
Apr 22, 2014, 8:20:33 PM4/22/14
to rav...@googlegroups.com
<package id="RavenDB.Embedded" version="2.5.2874" targetFramework="net45" />


[Test]
public void Cant_Use_Embedded_Http_Server()
{
    var port = new Random().Next(49152, 65535);
    var url = "http://127.0.0.1:" + port;
    Console.WriteLine(url);

    NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(port);
    using (var docStore = new EmbeddableDocumentStore
    {
        UseEmbeddedHttpServer = true,
        Url = url
    }.Initialize())
    using (var session = docStore.OpenSession())
    {
        session.Store(new {Name = "Ronnie"});
        session.SaveChanges(); // System.Net.WebException : Unable to connect to the remote server
    }
}

/*   STACK TRACE

System.Net.WebException : Unable to connect to the remote server
  ----> System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it 127.0.0.1:50574
   at System.Net.HttpWebRequest.GetRequestStream(ref TransportContext context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at Raven.Abstractions.Connection.HttpRequestHelper.WriteDataToRequest(HttpWebRequest req, String data, Boolean disableCompression)
   at Raven.Client.Connection.HttpJsonRequest.Write(String data)
   at Raven.Client.Connection.ServerClient.DirectBatch(IEnumerable`1 commandDatas, OperationMetadata operationMetadata)
   at Raven.Client.Connection.ServerClient.<>c__DisplayClass91.<Batch>b__90(OperationMetadata u)
   at Raven.Client.Connection.ReplicationInformer.TryOperation(Func`2 operation, OperationMetadata operationMetadata, OperationMetadata primaryOperationMetadata, Boolean avoidThrowing, ref T result, ref Boolean wasTimeout)
   at Raven.Client.Connection.ReplicationInformer.ExecuteWithReplication(String method, String primaryUrl, OperationCredentials primaryCredentials, Int32 currentRequest, Int32 currentReadStripingBase, Func`2 operation)
   at Raven.Client.Connection.ServerClient.ExecuteWithReplication(String method, Func`2 operation)
   at Raven.Client.Connection.ServerClient.Batch(IEnumerable`1 commandDatas)
   at Raven.Client.Document.DocumentSession.SaveChanges()
   at Tests.SomeTests.Cant_Use_Embedded_Http_Server() in SomeTests.cs: line 34
--SocketException
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, ref Socket socket, ref IPAddress address, ConnectSocketState state, IAsyncResult asyncResult, ref Exception exception)

*/

Oren Eini (Ayende Rahien)

unread,
Apr 23, 2014, 1:59:25 AM4/23/14
to ravendb
When you specify a Url, we are actually assuming that you want to connect to a remote server, and not use the embedded feature.

    using (var docStore = new EmbeddableDocumentStore
    {
        UseEmbeddedHttpServer = true,
        DataDirectory = "db
    }.Initialize())



Oren Eini

CEO

Mobile: + 972-52-548-6969

Office:  + 972-4-674-7811

Fax:      + 972-153-4622-7811





--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages