Site Class1
Represents an IIS Web site.
Syntax
class Site : ConfiguredObject
Methods
The following table lists the methods exposed by the Site
class.
Name | Description |
---|---|
Create | Creates a new Web site. |
GetAllSections | (Inherited from ConfiguredObject.) |
GetSection | (Inherited from ConfiguredObject.) |
GetState | Returns the run-time state of a Web site. |
RevertToParent | Reverts a Web site configuration value or values to those of its parent site. |
Start | Starts an existing Web site. |
Stop | Stops a currently running Web site. |
Note
The IIS 6.0 WMI IIsWebServer class supported the Continue and Pause methods for a Web site. This functionality is no longer supported in IIS 7.
Properties
The following table lists the properties exposed by the Site
class.
Name | Description |
---|---|
ApplicationDefaults |
An ApplicationElementDefaults object whose read/write properties contain the default values for applications within a Web site. Individual application settings will override these defaults. |
Bindings |
A read/write array of BindingElement objects. |
Id |
A read/write uint32 value that contains the site ID. Site IDs must be unique. Note: To avoid binding conflicts, a site that is already running will stop if you change its site ID. |
Limits |
A read/write SiteLimits object that exposes connection-related limits for a site. |
LogFile |
A read/write SiteLogFile object that configures logging for a Web site. |
Name |
A read-only string value that contains the name of the Web site. Site names must be unique. This is the only key property for the Site class. |
ServerAutoStart |
A read/write boolean value. true if the Web site will start when the World Wide Web Publishing Service (WWW service) starts; otherwise, false . The default is true . |
TraceFailedRequestsLogging |
A TraceFailedRequestsLogging object that exposes read/write logging properties for the Web site. |
VirtualDirectoryDefaults |
A read-only VirtualDirectoryElementDefaults object that contains the default values for virtual directories in a site. Individual virtual directory settings will override these defaults. |
Remarks
You cannot set the physical path for a Web site by using the Site
class. Use the PhysicalPath
property of the root VirtualDirectory object instead.
Note
You must set the ApplicationPool
property on the root Application object, not on the Site
object.
Example
The following example sets the physical path for the default Web site.
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")
' Get the root virtual directory for the default Web site.
Set oVDir = oWebAdmin.Get(_
"VirtualDirectory.SiteName='Default Web Site',ApplicationPath='/',Path='/'")
' Set the physical path for the default Web site.
oVDir.PhysicalPath = "C:\MyContent"
oVDir.Put_
Subclasses
This class contains no subclasses.
Inheritance Hierarchy
Site
Requirements
Type | Description |
---|---|
Client | - IIS 7.0 on Windows Vista - IIS 7.5 on Windows 7 - IIS 8.0 on Windows 8 - IIS 10.0 on Windows 10 |
Server | - IIS 7.0 on Windows Server 2008 - IIS 7.5 on Windows Server 2008 R2 - IIS 8.0 on Windows Server 2012 - IIS 8.5 on Windows Server 2012 R2 - IIS 10.0 on Windows Server 2016 |
Product | - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 |
MOF file | WebAdministration.mof |
See Also
Application Class
ApplicationElementDefaults Class
ApplicationPool Class
BindingElement Class
ConfiguredObject Class
ServerContainsSite Class
SiteContainsApplication Class
SiteContainsConfigurationSection Class
SiteElementDefaults Class
SiteLimits Class
SiteLogFile Class
TraceFailedRequestsLogging Class
VirtualDirectory Class
VirtualDirectoryElementDefaults Class