I downloaded EventStoreDb, run:
EventStore.ClusterNode.exe --insecure
I created a console application:
using EventStore.ClientAPI;
using System.Text;
var connection = EventStoreConnection.Create(
new Uri("tcp://admin:changeit@localhost:1113")
);
await connection.ConnectAsync();
const string streamName = "newstream";
const string eventType = "event-type";
const string data = "{ \"a\":\"2\"}";
const string metadata = "{}";
var eventPayload = new EventData(
eventId: Guid.NewGuid(),
type: eventType,
isJson: true,
data: Encoding.UTF8.GetBytes(data),
metadata: Encoding.UTF8.GetBytes(metadata)
);
var result = await connection.AppendToStreamAsync(streamName, ExpectedVersion.Any, eventPayload);
And I have an exception:
EventStore.ClientAPI.Exceptions.ConnectionClosedException: ‘Connection ‘ES-f2cffa2d-a4cc-4850-9976-0113bd272a81’ was closed.’
And what now??