Configure Auto-Start Using Windows Server AppFabric Cmdlets
This topic describes how to configure auto-start for an application or a service by using AppFabric cmdlets.
To enable auto-start for an application
In the AppFabric Windows PowerShell console, execute the Set-ASApplication cmdlet with the -AutoStartMode parameter set to “All” or “Custom” to enable auto-start for services in the application. Setting the –AutoStartMode parameter to “All” enables auto-start for all services in the application. Setting the –AutoStartMode parameter to “Custom” specifies that auto-start is not enabled for any service in the application unless auto-start is specifically enabled for the service (by executing Enable-ASAppServiceAutoStart).
Enabling auto-start for an application adds serviceAutoStartEnabled set to a value of “true” in the applicationHost.config file at the server level. Enabling auto-start for all services in the application sets the serviceStartupMode attribute for the application in the applicationHost.config file to a value of “all”. Setting the mode to “Custom” sets the serviceStartupMode attribute to a value of “custom”.
Syntax options for Set-ASApplication:
Syntax 1
Set-ASApplication [-SiteName] <String> [[-VirtualPath] <String>] -AutoStartMode <All | Custom | Disable> [-Confirm] [-EnableApplicationPool] [-Force] [-WhatIf] [<CommonParameters>]
Syntax 2
Set-ASApplication [-Uri] <Uri> -AutoStartMode <All | Custom | Disable> [-Confirm] [-EnableApplicationPool] [-Force] [-WhatIf] [<CommonParameters>]
Syntax 3
Set-ASApplication -ApplicationObject <ApplicationInfo> -AutoStartMode <All | Custom | Disable> [-Confirm] [-EnableApplicationPool] [-Force] [-WhatIf] [<CommonParameters>]
Parameter | Description |
---|---|
-SiteName |
Site name for the WCF or WF application to enable auto-start for. |
-VirtualPath |
Virtual path for the WCF or WF application to enable auto-start for. |
-Uri |
Identifier of a specific service or application. |
-ApplicationObject |
Name of an application object, which results in the use of the corresponding Web.config file as the basis of operation of the cmdlet. |
–AutoStartMode <-All|-Custom> (optional) |
A value of “All” specifies that auto-start is enabled for all services in the application, and that the specific service auto-start settings are ignored (default behavior if–AutoStartMode is not included). A value of “Custom” specifies that auto-start is not enabled for any service in the application unless auto-start is specifically enabled for the service. The auto-start mode for a service is dependent upon the auto-start mode for an application. |
–EnableApplicationPool (optional) |
Enables auto-start for the application pool used by the application. Sets the startMode attribute of the application pool to “AlwaysRunning”. |
To disable auto-start for an application
In the AppFabric Windows PowerShell console, execute the Set-ASApplication cmdlet with the –AutoStartMode parameter set to “Disable” to disable auto-start for services in the application. This action deletes the serviceAutoStartMode attribute from the applicationHost.config file. Without the serviceStartupMode attribute, auto-start will be disabled.
Syntax options for Set-ASApplication:
Syntax 1
Set-ASApplication [-SiteName] <String> [[-VirtualPath] <String>] -AutoStartMode <All | Custom | Disable> [-Confirm] [-EnableApplicationPool] [-Force] [-WhatIf] [<CommonParameters>]
Syntax 2
Set-ASApplication [-Uri] <Uri> -AutoStartMode <All | Custom | Disable> [-Confirm] [-EnableApplicationPool] [-Force] [-WhatIf] [<CommonParameters>]
Syntax 3
Set-ASApplication -ApplicationObject <ApplicationInfo> -AutoStartMode <All | Custom | Disable> [-Confirm] [-EnableApplicationPool] [-Force] [-WhatIf] [<CommonParameters>]
Parameter | Description |
---|---|
-SiteName (required) |
Site name for the WCF or WF application to enable auto-start for. |
-VirtualPath (required) |
Virtual path for the WCF or WF application to enable auto-start for. |
-Uri |
Identifier of a specific service or application. |
-ApplicationObject |
Name of an application object, which results in the use of the corresponding Web.config file as the basis of operation of the cmdlet. |
–AutoStartMode <Disable> |
A value of “Disable” specifies that auto-start will be disabled for all services in the application. |
–EnableApplicationPool (optional) |
The name of the application pool that applies for the application. |
To get auto-start settings for an application
In the AppFabric Windows PowerShell console, execute the Get-ASApplication cmdlet to get auto-start settings for an application. The cmdlet returns the settings in the ApplicationInfo object.
Syntax options for Get-ASApplication:
Syntax 1
Get-ASApplication [[-SiteName] <String>] [[-VirtualPath] <String>] [[-ApplicationPoolName] <String>] [<CommonParameters>]
Parameter | Description |
---|---|
-SiteName (required) |
Site name for the WCF or WF application to get auto-start for. |
-VirtualPath (required) |
Virtual path for the WCF or WF application to get auto-start for. |
-ApplicationPoolName (required) |
The name of the application pool that applies for the application. |
To enable auto-start for a service
In the AppFabric Windows PowerShell console, execute the Enable-ASAppServiceAutoStart cmdlet to enable auto-start for a service. To do so, enable auto-start for the application that contains the service by executing Set-ASApplication with AutoStartMode set to “Custom”. Enabling auto-start for a service adds a serviceAddress line to the serviceAutoStart attribute for the service in the application Web.config file. You can indicate the service for which to enable auto-start by using the –SiteName –VirtualPath parameter set, the –Uri parameter set, or the ServiceObject parameter.
Syntax options for Enable-ASAppServiceAutoStart:
Syntax 1
Enable-ASAppServiceAutoStart [-SiteName] <String> [-VirtualPath] <String> [<CommonParameters>]
Syntax 2
Enable-ASAppServiceAutoStart [-Uri] <Uri> [<CommonParameters>]
Syntax 3
Enable-ASAppServiceAutoStart -ServiceObject <ServiceInfo> [<CommonParameters>]
Parameter | Description |
---|---|
-SiteName (required) |
Site name for the WCF or WF service to enable auto-start for. |
-VirtualPath (required) |
Virtual path for the WCF or WF service to enable auto-start for. |
-Uri |
Identifier of a specific service or application. |
-ServiceObject |
Name of a service object, which results in the use of the corresponding Web.config file as the basis of operation of the cmdlet. |
To disable auto-start for a service
In the AppFabric Windows PowerShell console, execute the Disable-ASAppServiceAutoStart cmdlet to disable auto-start for a service. Disabling auto-start for a service removes the serviceAddress line from the serviceAutoStart attribute for the service in the application Web.config file. You can indicate the service to disable auto-start for by using the –SiteName –VirtualPath parameter set, the –Uri parameter set, or the ServiceObject parameter.
Syntax options for Disable-ASAppServiceAutoStart:
Syntax 1
Disable-ASAppServiceAutoStart [-SiteName] <String> [-VirtualPath] <String> [-Confirm] [-WhatIf] [<CommonParameters>]
Syntax 2
Disable-ASAppServiceAutoStart [-Uri] <Uri> [-Confirm] [-WhatIf] [<CommonParameters>]
Syntax 3
Disable-ASAppServiceAutoStart -ServiceObject <ServiceInfo> [-Confirm] [-WhatIf] [<CommonParameters>]
Parameter | Description |
---|---|
-SiteName (required) |
Site name for the WCF or WF service to disable auto-start for. |
-VirtualPath (required) |
Virtual path for the WCF or WF service to disable auto-start for. |
-Uri |
Identifier of a specific service or application. |
-ServiceObject |
Name of a service object, which results in the use of the corresponding Web.config file as the basis of operation of the cmdlet. |
To get auto-start settings for a service
In the AppFabric Windows PowerShell console, execute the Get-ASAppServiceAutoStart cmdlet to get auto-start settings for a service. The cmdlet returns the settings in the ServiceAutoStartInfo object. You can indicate the service to get auto-start information for by using the –SiteName –VirtualPath parameter set, the –Uri parameter set, or the ServiceObject parameter.
Syntax options for Get-ASAppServiceAutoStart:
Syntax 1
Get-ASAppServiceAutoStart [-SiteName] <String> [-VirtualPath] <String> [<CommonParameters>]
Syntax 2
Get-ASAppServiceAutoStart [-Uri] <Uri> [<CommonParameters>]
Syntax 3
Get-ASAppServiceAutoStart -ServiceObject <ServiceInfo> [<CommonParameters>]
Parameter | Description |
---|---|
-SiteName (required) |
Site name for the WCF or WF service to get auto-start information for. |
-VirtualPath (required) |
Virtual path for the WCF or WF service to get auto-start information for. |
-Uri |
Identifier of a specific service or application. |
-ServiceObject |
Name of a service object, which results in the use of the corresponding Web.config file as the basis of operation of the cmdlet. |