Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Creates a Web application.
Syntax
oWebAdmin.Get("Application").Create(
ApplicationPath,
SiteName,
PhysicalPath
)
var app = webAdmin.Get("Application").Create(
ApplicationPath,
SiteName,
PhysicalPath
);
Parameters
Name | Description |
---|---|
ApplicationPath |
A required string value that contains the virtual path for the new application. The path cannot be changed after the application is created. |
PhysicalPath |
An optional string value that contains the physical path for the application's root virtual directory. |
SiteName |
A required string value that contains the name of the Web site on which the application will be created. |
Return Value
This method does not return a value.
Remarks
If the PhysicalPath
parameter contains a nonexistent directory, the Create
method will not automatically create the directory specified by PhysicalPath
.
Create
replaces previous methods of creating IIS applications. To create an application in IIS 6.0, you first created a new virtual directory by calling SpawnInstance_
on IIsWebVirtualDir and then called the IIsWebVirtualDir.AppCreate2, IIsWebVirtualDir.AppCreate, or IIsWebVirtualDir.AppCreate3 method.
Note
You cannot use Application.SpawnInstance_
and Application.Put_
to create a new application. A new application must have at least an application path and site name, and you can specify these only through the Create
method's ApplicationPath
and SiteName
parameters.
Example
The following example creates a new Web application.
Note
Because the Create
method is static, it must be called on the application class.
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")
' Define the Path, SiteName, and PhysicalPath parameters.
strAppPath = "/NewApp"
strSiteName = "Default Web Site"
strPhysPath = "D:\inetpub\NewApp"
' Create the new application.
oWebAdmin.Get("Application").Create strAppPath, strSiteName, strPhysPath
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 |