Export (0) Print
Expand All
0 out of 2 rated this helpful - Rate this topic

HostingEnvironment Class

Provides application-management functions and application services to a managed application within its application domain. This class cannot be inherited.

System.Object
  System.MarshalByRefObject
    System.Web.Hosting.HostingEnvironment

Namespace:  System.Web.Hosting
Assembly:  System.Web (in System.Web.dll)
[<Sealed>]
type HostingEnvironment =  
    class 
        inherit MarshalByRefObject 
    end

The HostingEnvironment type exposes the following members.

  NameDescription
Public methodHostingEnvironmentInfrastructure. Initializes a new instance of the HostingEnvironment class.
Top
  NameDescription
Public propertyStatic memberApplicationHostThis property supports the ASP.NET infrastructure and is not intended to be used directly from your code.
Public propertyStatic memberApplicationIDGets the unique identifier of the application.
Public propertyStatic memberApplicationPhysicalPathGets the physical path on disk to the application's directory.
Public propertyStatic memberApplicationVirtualPathGets the root virtual path of the application.
Public propertyStatic memberCacheGets the Cache instance for the current application.
Public propertyStatic memberInClientBuildManagerGets a value that indicates whether the hosting environment has access to the ASP.NET build system.
Public propertyStatic memberInitializationExceptionGets any exception thrown during initialization of the HostingEnvironment object.
Public propertyStatic memberIsDevelopmentEnvironmentGets a value that indicats whether the current application is in a development environment.
Public propertyStatic memberIsHostedGets a value indicating whether the current application domain is being hosted by an ApplicationManager object.
Public propertyStatic memberMaxConcurrentRequestsPerCPUGets or sets the maximum concurrent requests per CPU.
Public propertyStatic memberMaxConcurrentThreadsPerCPUGets or sets the maximum concurrent threads per CPU.
Public propertyStatic memberShutdownReasonReturns an enumerated value that indicates why the application terminated.
Public propertyStatic memberSiteNameGets the name of the site.
Public propertyStatic memberVirtualPathProviderGets the virtual path provider for this application.
Top
  NameDescription
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public methodStatic memberDecrementBusyCountReduces the count of busy objects in the hosted environment by one.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodStatic memberImpersonate()Impersonates the user represented by the application identity.
Public methodStatic memberImpersonate(IntPtr)Impersonates the user represented by the specified user token.
Public methodStatic memberImpersonate(IntPtr, String)Impersonates the user specified by the configuration settings for the specified virtual path, or the specified user token.
Public methodStatic memberIncrementBusyCountIncreases the count of busy objects in the hosted environment by one.
Public methodInitializeLifetimeServiceInfrastructure. Gives the HostingEnvironment object an infinite lifetime by preventing a lease from being created. (Overrides MarshalByRefObject.InitializeLifetimeService().)
Public methodStatic memberInitiateShutdownStarts shutting down the web application associated with this host and removes registered objects from the system.
Public methodStatic memberMapPathMaps a virtual path to a physical path on the server.
Public methodStatic memberMessageReceivedThis method supports the ASP.NET infrastructure and is not intended to be used directly from your code.
Public methodStatic memberRegisterObjectPlaces an object in the list of registered objects for the application.
Public methodStatic memberRegisterVirtualPathProviderRegisters a new VirtualPathProvider instance with the ASP.NET compilation system.
Public methodStatic memberSetCultures()Sets the current thread to the culture specified in the application configuration file.
Public methodStatic memberSetCultures(String)Sets the current thread to the culture of the specified virtual path.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodStatic memberUnregisterObjectRemoves an object from the list of registered objects for the application.
Top
  NameDescription
Public eventStatic memberStopListening[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.
Top

Each managed application domain contains a static instance of the HostingEnvironment class, which provides access to application-management functions and application services.

The following code example is a webpage that displays the application information available from the HostingEnvironment object.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.