ExtendVirtualServer(System.Uri, Boolean, String, Boolean, String, String) Method
The ExtendVirtualServer method of the SPGlobalAdmin class extends a virtual server with Microsoft Windows SharePoint Services based on the specified URI and application pool information.
Parameters
uri An absolute URI for the virtual server, which includes the host name, port number, and custom URL information. For example, if the URI is http://Server_Name:Port_Number/Sample_URL, when the virtual server is extended Sample_URL will be included as part of the URL.
bCreateNewAppPool true to create an application pool; otherwise, false.
strAppPoolId A string that specifies an ID for the application pool.
bConfigurableAppPoolAccount true to indicate that the application pool account is configurable; otherwise, false.
strAppPoolUserName A string that specifies a user name for the administrator account of the application pool. If bCreateNewAppPool is true, specify one of the following values for strAppPoolUserName:
- NetworkService
- LocalService
- LocalSystem
strAppPoolPassword A string that specifies a password for the administrator account of the application pool. The strAppPoolPassword parameter is required only if the bConfigurableAppPoolAccount parameter is set to true.
Return Value
A Microsoft.SharePoint.Administration.SPVirtualServer object that represents the extended virtual server.
Remarks
Before extending a virtual server by using the ExtendVirtualServer method, you can customize the web.config file that will be placed on the server by creating an XML file that supplements the web.config file on the current server. For information, see Working with web.config Files in Windows SharePoint Services.
Example
The following code example extends a specified virtual server, adds a content database for the virtual server, and creates a top-level site.
This example assumes the presence of an administrative form digest in the .cs or .vb file. For information on security validation, see Security Validation and Making Posts to Update Data.
Requirements
Platforms: Microsoft Windows Server 2003
Security: Code Access Security