We have configured a job where to build and deploy automatically on each commit on bitbucket. We are successfully builds and package the solution by using msbuild but the following error occurs when we try to deploy it using msdeploy.
Error Code: ERROR_INSUFFICIENT_ACCESS_TO_APPHOSTCONFIG
More Information: An error occurred when committing changes to the IIS Configuration System. The identity performing the operation was 'NT AUTHORITY\SYSTEM'. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_INSUFFICIENT_ACCESS_TO_APPHOSTCONFIG.
Error: Filename: \\?\C:\Windows\system32\inetsrv\config\applicationHost.config
Error: Cannot write configuration file
I looked into the file and gave permission for the SYSTEM user but that did not fix the problem. Following is the command we are using for msdeploy.
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package="D:\Deploy\*****.zip" -dest:auto,computerName=localhost
This build is done in a load balanced enviornment where we use two servers. So application provisioning is enabled. How to fix this issue?
iis version - 8.5 OS - Windows 2012 R2
After giving permission for shared applicationhost.config file the problem was fixed. Here is a guide to how to give permission for shared applicationhost.config file.