TsgcWebSocketServer_HTTPAPIMethods › ReStart

ReStart Method

Stops and then restarts the HTTP.sys server from a secondary thread, useful after changing bindings, ports or SSL certificates at runtime.

Syntax

public void ReStart();

Remarks

ReStart chains a Stop followed by a Start inside an internal worker thread, so the caller is not blocked while connections are closed and URL groups are re-registered. It is the recommended way to apply configuration changes that require the server to re-bind its URLs at runtime, such as changing Host, Port, Bindings or a certificate hash. The OnShutdown event fires once the old listener stops, and OnStartup fires again once the new listener is accepting connections. When changing bindings call Bindings.Clear after stopping so the old entries are not reused.

Example


oServer.Port = 8080;
oServer.ReStart();

Back to Methods