How to Start/Stop IIS on the target Windows server before deployment in Azure Devops Pipeline

流过昼夜 提交于 2020-06-17 00:49:41

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!