IStopListeningRegisteredObject Interface


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

[Supported in the .NET Framework 4.5.1 and later versions]

Listens for GL_STOP_LISTENING notifications from IIS.

Namespace:   System.Web.Hosting
Assembly:  System.Web (in System.Web.dll)

public interface IStopListeningRegisteredObject : IRegisteredObject


Requests a registered object to unregister.(Inherited from IRegisteredObject.)


[Supported in the .NET Framework 4.5.1 and later versions]

Stops listening for new requests.

.NET Framework
Available since 4.5.1

Instance members of this type are not guaranteed to be thread safe. The StopListening method can be called at any time, including while a call to another method (such as Stop) on this same object is executing or while calls to other objects' StopListening methods are executing. Because the execution of these methods is multithreaded, there is an interval in which the StopListening method might be called even after a call to UnregisterObject has completed.

You can implement the IStopListeningRegisteredObject interface by passing an object to the RegisterObject method. The passed object listens for GL_STOP_LISTENING notifications from IIS. You can call this implementation when ASP.NET receives a GL_STOP_LISTENING notification from IIS, which signals that IIS is no longer listening for new requests for this application. The web server can allow requests that are in progress to run to completion. If your application processes long running requests, you might want to have the application listen for these IIS notifications to gracefully wind down the request. The StopListening method contrasts with the Stop method, which signals immediate application shutdown.

Return to top