HostingEnvironment Class
Provides application-management functions and application services to a managed application within its application domain. This class cannot be inherited.
Assembly: System.Web (in System.Web.dll)
| Name | Description | |
|---|---|---|
![]() | HostingEnvironment() | This API supports the product infrastructure and is not intended to be used directly from your code. Initializes a new instance of the HostingEnvironment class. |
| Name | Description | |
|---|---|---|
![]() ![]() | ApplicationHost | This property supports the ASP.NET infrastructure and is not intended to be used directly from your code. |
![]() ![]() | ApplicationID | Gets the unique identifier of the application. |
![]() ![]() | ApplicationMonitors | Gets a group of repleacable monitor objects used by ASP.NET subsystems to maintain application health. |
![]() ![]() | ApplicationPhysicalPath | Gets the physical path on disk to the application's directory. |
![]() ![]() | ApplicationVirtualPath | Gets the root virtual path of the application. |
![]() ![]() | Cache | Gets the Cache instance for the current application. |
![]() ![]() | InClientBuildManager | Gets a value that indicates whether the hosting environment has access to the ASP.NET build system. |
![]() ![]() | InitializationException | Gets any exception thrown during initialization of the HostingEnvironment object. |
![]() ![]() | IsDevelopmentEnvironment | Gets a value that indicats whether the current application is in a development environment. |
![]() ![]() | IsHosted | Gets a value indicating whether the current application domain is being hosted by an ApplicationManager object. |
![]() ![]() | MaxConcurrentRequestsPerCPU | Gets or sets the maximum concurrent requests per CPU. |
![]() ![]() | MaxConcurrentThreadsPerCPU | Gets or sets the maximum concurrent threads per CPU. |
![]() ![]() | ShutdownReason | Returns an enumerated value that indicates why the application terminated. |
![]() ![]() | SiteName | Gets the name of the site. |
![]() ![]() | VirtualPathProvider | Gets the virtual path provider for this application. |
| Name | Description | |
|---|---|---|
![]() | CreateObjRef(Type^) | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.) |
![]() ![]() | DecrementBusyCount() | Reduces the count of busy objects in the hosted environment by one. |
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetLifetimeService() | Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.) |
![]() | GetType() | |
![]() ![]() | Impersonate() | Impersonates the user represented by the application identity. |
![]() ![]() | Impersonate(IntPtr) | Impersonates the user represented by the specified user token. |
![]() ![]() | Impersonate(IntPtr, String^) | Impersonates the user specified by the configuration settings for the specified virtual path, or the specified user token. |
![]() ![]() | IncrementBusyCount() | Increases the count of busy objects in the hosted environment by one. |
![]() | InitializeLifetimeService() | This API supports the product infrastructure and is not intended to be used directly from your code. Gives the HostingEnvironment object an infinite lifetime by preventing a lease from being created.(Overrides MarshalByRefObject::InitializeLifetimeService().) |
![]() ![]() | InitiateShutdown() | Starts shutting down the web application associated with this host and removes registered objects from the system. |
![]() ![]() | MapPath(String^) | Maps a virtual path to a physical path on the server. |
![]() ![]() | MessageReceived() | This method supports the ASP.NET infrastructure and is not intended to be used directly from your code. |
![]() ![]() | QueueBackgroundWorkItem(Action<CancellationToken>^) | [Supported in the .NET Framework 4.5.2 and later versions] Schedules a task which can run in the background, independent of any request. |
![]() ![]() | QueueBackgroundWorkItem(Func<CancellationToken, Task^>^) | [Supported in the .NET Framework 4.5.2 and later versions] Schedules a task which can run in the background, independent of any request. |
![]() ![]() | RegisterObject(IRegisteredObject^) | Places an object in the list of registered objects for the application. |
![]() ![]() | RegisterVirtualPathProvider(VirtualPathProvider^) | Registers a new VirtualPathProvider instance with the ASP.NET compilation system. |
![]() ![]() | SetCultures() | Sets the current thread to the culture specified in the application configuration file. |
![]() ![]() | SetCultures(String^) | Sets the current thread to the culture of the specified virtual path. |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
![]() ![]() | UnregisterObject(IRegisteredObject^) | Removes an object from the list of registered objects for the application. |
| Name | Description | |
|---|---|---|
![]() ![]() | StopListening | [Supported in the .NET Framework 4.5.1 only] Occurs when the worker process or application pool associated with this host has stopped listening for new requests and will eventually shut down. |
Each managed application domain contains a static instance of the HostingEnvironment class, which provides access to application-management functions and application services.
Available since 2.0
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.



