Encapsulation is suitable for use as an internal tool in projects that need to operate IIS in the installer, such as building a website and building a virtual directory
Basic Form Form: iisutil.exe Command / Argument 1: Value 1 / Parameter 2: Value 2
The return value of the process is the running result, 0 indicates success, and the other values indicate error, see the error code below
===========================================
1. Create a site iisutil CreateSite /siteName:Rvsp /httpPort:80 /httpsPort:445 /physicalPath:C:\wwwroot /sslHash:5681154ac76ef9b73af44b08e4730933c633b26b
Parameters: siteName: The site name, required httpPort: Port, required under IIS6, not required in IIS7 httpsPort: ssl port, not required physicalPath: Physical path, required sslHash: The certificate hash is required when httpsPort is specified, and the certificate must be placed in the personal area of the LocalMachine
---------------------- 2. Delete the site iisutil RemoveSite /siteName:Rvsp
Parameters: siteName: The site name, required
---------------------- 3. Create an application pool iisutil CreateAppPool /poolName:RvspPool
Parameters: poolName: The pool name, required
---------------------- 4. Delete the application pool iisutil RemoveAppPool /poolName:RvspPool
Parameters: poolName: The pool name, required
---------------------- 5. Create a virtual directory iisutil CreateDir /siteName:Rvsp /virtualPath:/log /physicalPath:C:\wwwroot\log /enableAllMimeTypes:true
Parameters: siteName: The site name, required virtualPath: The virtual path, starting with /, currently only supports one level, required physicalPath: Physical path, required enableAllMimeTypes: Optional to allow downloading of arbitrary files
---------------------- 6. Delete the virtual directory iisutil RemoveDir /siteName:Rvsp /virtualPath:/log
Parameters: siteName: The site name, required virtualPath: The virtual path, required
---------------------- 7. Create an application iisutil CreateApp /siteName:Rvsp /virtualPath:/log /physicalPath:C:\wwwroot\log /poolName:RvspPool /useSsl:true
Parameters: siteName: The site name, required virtualPath: The virtual path, starting with /, currently only supports one level, required physicalPath: Physical path, required poolName: The name of the application pool, required useSsl: whether to require ssl, not required
---------------------- 8. Delete the application iisutil RemoveApp /siteName:Rvsp /virtualPath:/log /physicalPath:C:\wwwroot\log /poolName:RvspPool /useSsl:true
Parameters: siteName: The site name, required virtualPath: The virtual path, required
---------------------- 9. Determine whether the site exists iisutil SiteExist /siteName:Rvsp
Parameters: siteName: The site name, required Return value: 400 does not exist 503 exists
---------------------- 10. Replace the site SSL certificate iisutil SetCert /siteName:Rvsp /sslHash:5681154ac76ef9b73af44b08e4730933c633b26b
Parameters: siteName: The site name, required sslHash: Certificate hash, required, the certificate to be placed in the personal area of the LocalMachine
---------------------- 11. Replace the site port iisutil SetPort /siteName:Rvsp /httpPort:8080 /httpsPort:8081
Parameters: siteName: The site name, required httpPort: Port httpsPort: ssl port
===========================================
Error Code:
302: Incorrect parameter 400: Site not found 401: Application pool not found 402: Application not found 403: Root app not found 404: Virtual directory not found 500: IIS version unknown 501: http port is occupied 502: The https port is occupied 503: The site already exists 504: Application pool exists 505: The application already exists 506: The virtual directory already exists 909: Unknown error
Interface:
IIS6 implementation:
IIS7 implementation:
Source code download:
Tourists, if you want to see the hidden content of this post, please Reply
|