ServiceHostBase.OnClose(TimeSpan) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Closes down the hosted service, including their channel dispatchers and associated instance contexts and listeners.
protected:
override void OnClose(TimeSpan timeout);
protected override void OnClose (TimeSpan timeout);
override this.OnClose : TimeSpan -> unit
Protected Overrides Sub OnClose (timeout As TimeSpan)
Parameters
- timeout
- TimeSpan
The TimeSpan that specifies how long the on-close operation has to complete before timing out.
Remarks
Calling OnClose(TimeSpan) does the following:
Closes all input to ChannelDispatcher, which also closes their associated IChannelListener instances. This stops any new channels from being accepting.
Calls CloseInput on all InstanceContext objects, which mean they stop accepting new messages.
Waits for all InstanceContext objects to close down, which happens when their associated channels finish sending all pending messages.
Closes the ChannelDispatcher objects associated with the host.