Advanced
Documentation menu
The advanced notes cover process configuration, invocation timeouts, concurrency and debugging. They are for applications that have moved past the first successful call.
Configuration
The service uses the .NET options pattern. NodeJSProcessOptions controls the Node.js process, OutOfProcessNodeJSServiceOptions controls process management and HttpNodeJSServiceOptions controls the HTTP connection between .NET and Node.js.
services.Configure<NodeJSProcessOptions>(options => options.NodeAndV8Options = "--inspect");
services.Configure<OutOfProcessNodeJSServiceOptions>(options => options.InvocationTimeoutMS = 30000);
services.Configure<HttpNodeJSServiceOptions>(options => options.Version = HttpVersion.Version20);
Concurrency
By default, invocations share one Node.js process. Set OutOfProcessNodeJSServiceOptions.Concurrency to Concurrency.MultiProcess and choose a degree to distribute work across several processes. Invocations are balanced in a round robin order.
Debugging
Add debugger statements to the JavaScript module, set NodeAndV8Options to --inspect-brk, set the invocation timeout to a negative value and open chrome://inspect in Chrome. The Node.js process will wait for the debugger before it executes the module.
Customizing logic
Every dependency in the service is replaceable. Register your own implementation of IHttpContentFactory, INodeJSProcess or IEmbeddedResourcesService when the default behavior does not fit. The static API exposes SetServices for the same purpose.