Controlling Applications Using AppFabric Cmdlets
This topic describes how to stop and start an application by using AppFabric cmdlets. To stop an application, the Stop-ASApplication cmdlet disables all application protocols and stops the application auto-start. To start an application, the Start-ASApplication cmdlet re-enables all application protocols and restores the application auto-start. You can also execute the Get-ASApplication cmdlet to determine the state of application protocols and auto-start.
For more information about executing cmdlets, see Running AppFabric Cmdlets.
To stop an application
In the AppFabric Windows PowerShell console, execute the Stop-ASApplication cmdlet in order to stop an application properly. This cmdlet does the following:
Disables all application protocols (disabling the message flow) of an application by copying all the contents of the "enabledProtocols" attribute to the "previouslyEnabledProtocols" attribute (always overwriting its contents) in the \configuration\system.applicationHost\sites\site\application element in the applicationHost.config file for a particular virtual application. The cmdlet then clears the contents of the "enabledProtocols" attribute.
Stops the application auto-start by setting the serviceAutoStartEnabled property in the virtual application configuration in the applicationHost.config file to “false”.
Syntax options:
Syntax 1
Stop-ASApplication [-SiteName] <String> [[-VirtualPath] <String>] [-Confirm] [-WhatIf] [<CommonParameters>]
Syntax 2
Stop-ASApplication [-Uri] <Uri> [-Confirm] [-WhatIf] [<CommonParameters>]
Syntax 3
Stop-ASApplication -ApplicationObject <ApplicationInfo> [-Confirm] [-WhatIf] [<CommonParameters>]
Parameter | Description |
---|---|
-SiteName <String> –VirtualPath <String> |
A pointer to a site or application, indicating which application or applications to stop. If the parameter set indicates a site, the cmdlet will stop all applications within the site. |
-Uri <Uri> |
A pointer to a specific site or application, indicating which application or applications to stop. If the parameter set indicates a site, the cmdlet will stop all applications within the site. |
-ApplicationObject <ServiceInfo> |
A pointer to a specific application to stop. |
-Confirm |
If present, prompts you for confirmation before executing the command. |
-WhatIf |
If present, displays a message that describes the effect of the command, instead of executing the command. |
To start an application
In the AppFabric Windows PowerShell console, execute the Start-ASApplication cmdlet in order to start an application properly. The cmdlet does the following:
Re-enables application protocols in the applicationHost.config file by copying the contents of “previouslyEnabledProtocols” into “enabledProtocols”, and then removing the "previouslyEnabledProtocols" attribute.
Restores the application auto-start by setting serviceAutoStartEnabled in the applicationHost.config file to “True” if the application’s serviceAutoStartMode attribute in the applicationHost.config file is “All” or “Custom”.
Syntax options:
Syntax 1
Start-ASApplication [-SiteName] <String> [[-VirtualPath] <String>] [-StartApplicationPool] [<CommonParameters>]
Syntax 2
Start-ASApplication [-Uri] <Uri> [-StartApplicationPool] [<CommonParameters>]
Syntax 3
Start-ASApplication -ApplicationObject <ApplicationInfo> [-StartApplicationPool] [<CommonParameters>]
Parameter | Description |
---|---|
-SiteName <String> –VirtualPath <String> |
A pointer to a site or application, indicating which application or applications to start. If the parameter set indicates a site, the cmdlet will start all applications within the site. |
-Uri <Uri> |
A pointer to a specific site or application, indicating which application or applications to start. If the parameter set indicates a site, the cmdlet will start all applications within the site. |
-ApplicationObject <ServiceInfo> |
A pointer to a specific application to start. |
-StartApplicationPool |
If this flag is present, the cmdlet starts the application pool if it is not running. For this to happen, the startMode of the application’s appPool must be set to “AlwaysRunning”. |
To determine the state of an application
In the AppFabric Windows PowerShell console, execute the Get-ASApplication cmdlet in order to return information about the state of the operation. Get-ASApplication returns the ApplicationInfo object. You can determine the state of the application from the properties MessageFlowStatus, AutoStartEnabled, and AutoStartMode in the ApplicationInfo object.
Syntax options:
Syntax 1
Get-ASApplication [[-SiteName] <String>] [[-VirtualPath] <String>] [[-ApplicationPoolName] <String>] [<CommonParameters>]
Parameter | Description |
---|---|
-SiteName <String> –VirtualPath <String> |
A pointer to a site or application to return information for. If the parameter set indicates a site, the cmdlet will return information for all applications in the site. |
-ApplicationPoolName |
The name of the application pool used by the application. |
2012-09-12