public void Start(string bindUrl)
{
Ensure.NotNull(bindUrl, nameof(bindUrl));
_httpListener = new HttpListener { IgnoreWriteExceptions = false };
_httpListener.Prefixes.Add(bindUrl);
_httpListener.Start();
AsyncCallback acceptConnection = null;
acceptConnection = state =>
{
try
{
HttpListenerContext clientContext = _httpListener.EndGetContext(state);
Log.Info($"New Ecr connection from: {clientContext.Request.RemoteEndPoint}");
ProcessAsync(clientContext);
}
catch (Exception ex)
{
Log.Error(ex);
}
finally
{
_httpListener.BeginGetContext(acceptConnection, null);
}
};
_httpListener.BeginGetContext(acceptConnection, null);
RegisterActions();
}