Today I was working on a new Continuous Development task for one of my Projects. I was testing if it works and got an error message. After Fixing the error I rerun the deployment and got an error in an earlier step where I use a PowerShell script to stop the Default WebAppPool. It was strange because the script worked fine before. I found out that the problem was that the World Wide Web Publishing Service wasn’t running. In this post, I will tell you how to fix this problem.
During the CD I got the following error while executing the PowerShell script: [error]Command execution stopped because the preference variable “ErrorActionPreference” or common parameter is set to Stop: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)). The script only contains two lines of code:
Stop-WebSite ‘Default Web Site’
After I encountered this error I connected to the Server and saw that the WebAppPool (IIS –> Sites –> Default Web Site) wasn’t running. I clicked on Start and got the following error message:
Starting the World Wide Web Publishing Service (W3SVC)
After that, I went to the Services (Computer–> right click on manage –> Configuration –> Services or directly Services in the Start menu) and saw that the World Wide Web Publishing Service wasn’t running. Right-click the service and select Start. Then the service should be running. You can see that on the left column where you should have the Options Stop and Restart the service.
After I started the services manually, the PowerShell script could stop the WebAppPool automatically.
For more information see Technet.