ApplicationHost Infrastucture

Hi,

I am making ApplicationHost Infrastucture server. It works mostly as expected, but I have following questions:

  1. How to handle “Dispatcher not found” exceptions? I am using http(s) server channel and I’d like to show my own html response for 500/not found with a chance to log all such requests (through ILogger interface).
  2. where best to load certificate that is used UseNetworkServer. Certificate is configured in appsettings.json (IConfiguration interface)?

Hello

Sorry for the belated response

Unfortunately there is no unified API to intercept unknown requests that would work for all server channels.
Assuming you are using IpHttpServerChannel you need to handle the HttpRequest event as:

...
  e.Response.ContentBytes = this.GetHttpResponse(sender, e.Request.Header.RequestPath, e.Response.Header);
  e.Handled = true;
...

GetHttpResponse is a custom method that provides some content based on the requested path.

Inherit a class from the RemObkects.SDK.Server.NetworkServer class. Add a constructor that would accept IOptions<...> parameter. Override the InternalStart method and setup the certificate BEFORE calling the base implementation of this method.

Register this class via the UseNetworkServer<T> call in the server app startup code.

Note: In the following releases it will be possible to override the SetupServer method (a more logical place to fine-tune the network server infrastructure)

Regards

Logged as bugs://D19257.