Cannot get embedded eventstore to work

I’m trying to get use Embedded eventstore to do some integration testing. When running I get:

Exiting with exit code: 1.

Exit reason: The requested address is not valid in its context

``

The connection connects, however, but then I get “Authorization error” when trying to append an event, even though I explicitly set the user credentials. What am I doing wrong?

class Program

{

static void Main(string[] args)

{

var connection = CreateConnection().Result;

connection.AppendToStreamAsync(“test”, ExpectedVersion.Any, new UserCredentials(“admin”, “changeit”), new EventData(Guid.NewGuid(), “test”, true, Encoding.UTF8.GetBytes("{“foo” : ‘bar’}"), new byte[0])).Wait();

Console.ReadLine();

}

static async Task CreateConnection()

{

var noneIp = new IPEndPoint(IPAddress.None, 0);

var clusterVNode = EmbeddedVNodeBuilder

.AsSingleNode()

.RunInMemory()

.WithExternalTcpOn(noneIp)

.WithInternalTcpOn(noneIp)

.WithExternalHttpOn(noneIp)

.WithInternalHttpOn(noneIp)

.Build();

var nodeTcs = new TaskCompletionSource();

clusterVNode.NodeStatusChanged += (sender, args) =>

{

if (args.NewVNodeState == VNodeState.Master) nodeTcs.SetResult(true);

};

clusterVNode.Start();

await nodeTcs.Task;

var settings = ConnectionSettings.Create()

.UseConsoleLogger()

.EnableVerboseLogging()

.SetDefaultUserCredentials(new UserCredentials(“admin”, “changeit”))

.KeepReconnecting();

var connection = EmbeddedEventStoreConnection.Create(clusterVNode, settings);

var connectionTcs = new TaskCompletionSource();

connection.Connected += (sender, args) => connectionTcs.SetResult(connection);

await connection.ConnectAsync();

return await connectionTcs.Task;

}

}

``

IIRC this is due to EmbeddedConnection not honoring default
credentials which will be in 3.4.0 (already pr-ed)

What happens if you set the credentials explicitly on the write?

I am setting on the write.

"Exiting with exit code: 1.
Exit reason: The requested address is not valid in its context"

This looks like the node isn't actually running.

@all my guess is one of the places binding is coming up when being
given ipaddress.none

If you use loopback does the node come up?

Same error. It’s actually “Authenication Error”

By default you shouldn't even need credentials here. what do you get
removing them all together?

That worked. Can write, read and subscribe now.

Still getting the message:

Exiting with exit code: 1.

Exit reason: The requested address is not valid in its context

Do you get this when passing loopback or only with IPAddress.None?

Only with None

You can safely ignore this, it just means you won’t be able to communicate to it over a network (which is the point :))

We should probably make it not put up the error. Do you know which
service is causing it?

I believe it is somewhere in the http stuff

We use OnDefaultEndpoints(). rather than WithExternalTcpOn(noneIp).WithInternalTcpOn(noneIp).WithExternalHttpOn(noneIp).WithInternalHttpOn(noneIp)

and it works. note: We are not using the web access.

-Chris