Error while creating projection

I’m having troubles creating a projection via the EventStore.ClientApi.Projections.ProjectionManager class.

Here’s the error:

System.AggregateException: One or more errors occurred. (An error occurred while sending the request.)

—> System.Net.Http.HttpRequestException: An error occurred while sending the request.

—> System.Net.Http.WinHttpException: The server returned an invalid or unrecognized response

EventStore version is 4.1.1-hotfix1-1

EventStore.ClientApi version is

Here’s the code including the projection query. I’m able to use exactly the same projection query text successfully while creating the projection in the web UI.

Is there a problem using “linkTo” in the methods provided by the ProjectionManager?

I noticed that while an overload of the CreateContinuousAsync method includes a parameter for “trackEmittedStreams”, there is no available parameter for “emitEnabled”

var projectionName = “LinkedEventsTest”;

var projectionQuery = @“fromStream(‘linkedEventSource’).when({’$any’:function(s,e){linkTo(‘linkedEventSink’, e, {‘meta’:‘data’});}})”;

var credentials = new global::EventStore.ClientAPI.SystemData.UserCredentials(EventStoreOptions.UserName, EventStoreOptions.Password);

var projectionsManager = new global::EventStore.ClientAPI.Projections.ProjectionsManager(Log.AsEventStoreLogger(), EventStoreOptions.IPEndPoint, EventStoreOptions.OperationTimeout);

await projectionsManager.CreateContinuousAsync(projectionName, projectionQuery, true, credentials);

Thanks in advance for your advice,


If the issue is because of out of date ClientApi version, would it be possible to have the latest version published to nuget?

I’ve changed my nuget package to EventStore.Client v4.1.1, and the error remains the same.

Request that works, sent by the web UI, is:


The request sent by the Projection Manager, causing an error, appears to be of the form below which uses “1” and “True” instead of “yes” and adds the “type=JS” parameter.

return SendPost(endPoint.ToHttpUrl(httpSchema, “/projections/continuous?name={0}&type=JS&emit=1&trackemittedstreams={1}”, name, trackEmitted), query, userCredentials, HttpStatusCode.Created);

Solved it. I was connecting to the wrong port. Needed to use the External Http port, 2113, instead of the External Tcp port, 1113