问题
I created the step in Azure Devops to Start and Stop IIS Website but it is failing with below error message:
**2020-05-23T10:28:04.7393424Z ##[section]Starting: Start 2020-05-23T10:28:04.7659676Z
2020-05-23T10:28:06.5436980Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe" start site /site.name:"taxrpt-deva" 2020-05-23T10:28:06.6132349Z ERROR ( message:The W3SVC service is not available - try starting the service first. ) 2020-05-23T10:28:06.7434786Z ##[error]Process 'appcmd.exe' exited with code '50'. 2020-05-23T10:28:06.7680874Z ##[section]Finishing: Start **
Azure IIS Web App Manage Screen Shot
回答1:
How to Start/Stop IIS on the target Windows server before deployment in Azure Devops Pipeline
According to the image you provided, you are using the Deprecated task IIS Web App manage:
To resolve this issue, please try to use the task WinRM - IIS Web App Management.
Hope this helps.
回答2:
As per the first line of question, you want to stop the IIS website infact rather than IIS.
The simplest way is to create a blank file 'App_Offline.htm' in the deployment directory. Official reference link.
I assume that as you want to stop the IIS/webapp you should have access of the deployment directory. This approach should work even if your azure devops Agent is running on other network machine. This file will shutdown your application and after deploying the build artifacts you may run powershell command task to delete that file from the shared directory like shown in the sample:
来源:https://stackoverflow.com/questions/61976021/how-to-start-stop-iis-on-the-target-windows-server-before-deployment-in-azure-de