IIS deploy

Hello,

Trying to run a deployment process but having an issue detailed below, surely remember it worked on a different solution, but now even stopped working on that as well, with the same problem. Looks like an access prevellege, but cant see how to address it.

Was running experiments on the machine (not octopus deploy related), ending up uninstall/re-install IIS. If this helps at all.

Thanks in advance.
ZZ

The error:
== Failed: Step 4: Deploy ==
09:07:10 Fatal | The step failed: Activity Deploy on LocalDev failed with error ‘The remote script failed with exit code 1’.
09:07:10 Verbose | Deploy completed
|
| Failed: LocalDev
09:05:43 Verbose | Octopus Server version: 3.13.0+Branch.master.Sha.872899cdf487a79ef334d6b3c310d671b65a57df
09:05:43 Verbose | Environment Information:
| OperatingSystem: Microsoft Windows NT 6.1.7601 Service Pack 1
| OsBitVersion: x64
| Is64BitProcess: True
| CurrentUser: NT AUTHORITY\SYSTEM
| MachineName: W7PC7535
| ProcessorCount: 8
| CurrentDirectory: C:\windows\system32
| TempDirectory: C:\windows\TEMP
| HostProcessName: Octopus.Server
09:05:43 Info | Deploying package ‘C:\Octopus\Tentacle\Files\CapitaPortal.1.0.0.0.nupkg-960bf668-15dc-42d6-affe-d0ab3d87428a’ to machine 'https://localhost:10933/'
09:05:44 Verbose | Octopus Deploy: Calamari version 3.7.58+Branch.master.Sha.09995cad06e02fc582376226a19d6baa8181c81d
09:05:44 Verbose | Environment Information:
09:05:44 Verbose | OperatingSystem: Microsoft Windows NT 6.1.7601 Service Pack 1
09:05:44 Verbose | OsBitVersion: x64
09:05:44 Verbose | Is64BitProcess: True
09:05:44 Verbose | CurrentUser: NT AUTHORITY\SYSTEM
09:05:44 Verbose | MachineName: W7PC7535
09:05:44 Verbose | ProcessorCount: 8
09:05:44 Verbose | CurrentDirectory: C:\Octopus\Tentacle\Work\20170504080543-8
09:05:44 Verbose | TempDirectory: C:\windows\TEMP
09:05:44 Verbose | HostProcessName: Calamari
09:05:44 Info | Deploying package: C:\Octopus\Tentacle\Files\CapitaPortal.1.0.0.0.nupkg-960bf668-15dc-42d6-affe-d0ab3d87428a
09:05:51 Verbose | Extracting package to: C:\Octopus\Applications\Development\CapitaPortal\1.0.0.0_8
09:06:20 Verbose | Extracted 4201 files
09:06:25 Info | Transforming ‘C:\Octopus\Applications\Development\CapitaPortal\1.0.0.0_8\Web.config’ using ‘C:\Octopus\Applications\Development\CapitaPortal\1.0.0.0_8\Web.Release.config’.
09:06:25 Verbose | Warning will be elevated to errors. Prevent this by adding the variable Octopus.Action.Package.TreatConfigTransformationWarningsAsErrors and setting it to false.
09:06:25 Verbose | Executing SetAttributes (transform line 8, 10)
09:06:25 Verbose | on /configuration/connectionStrings/add[@name=‘Xrm’]
09:06:25 Verbose | Applying to ‘add’ element (source line 16, 6)
09:06:25 Verbose | Set ‘name’ attribute
09:06:25 Verbose | Set ‘connectionString’ attribute
09:06:25 Verbose | Set 2 attributes
09:06:25 Verbose | Done executing SetAttributes
09:06:25 Verbose | Executing RemoveAttributes (transform line 12, 18)
09:06:25 Verbose | on /configuration/system.web/compilation
09:06:25 Verbose | Applying to ‘compilation’ element (source line 68, 6)
09:06:25 Verbose | Removed ‘debug’ attribute
09:06:25 Verbose | Removed 1 attributes
09:06:25 Verbose | Done executing RemoveAttributes
09:06:25 Verbose | Looking for appSettings, applicationSettings, and connectionStrings in any .config files
09:06:25 Info | No matching appSetting, applicationSetting, nor connectionString names were found in: C:\Octopus\Applications\Development\CapitaPortal\1.0.0.0_8\Web.config
09:06:25 Info | No matching appSetting, applicationSetting, nor connectionString names were found in: C:\Octopus\Applications\Development\CapitaPortal\1.0.0.0_8\Web.Debug.config
09:06:25 Verbose | File ‘C:\Octopus\Applications\Development\CapitaPortal\1.0.0.0_8\Web.Release.config’ was interpreted as an XML configuration transform; variable substitution won’t be attempted.
09:06:25 Info | No matching appSetting, applicationSetting, nor connectionString names were found in: C:\Octopus\Applications\Development\CapitaPortal\1.0.0.0_8\bin\CapitaPortal.dll.config
09:06:25 Info | No matching appSetting, applicationSetting, nor connectionString names were found in: C:\Octopus\Applications\Development\CapitaPortal\1.0.0.0_8\Views\Web.config
09:06:25 Info | Purging the directory 'c:\inetput\myaccount’
09:06:40 Info | Copying package contents to 'c:\inetput\myaccount’
09:06:55 Info | Copied 4201 files
09:06:55 Verbose | Executing feature-class 'Calamari.Deployment.Features.IisWebSiteBeforeDeployFeature’
09:07:00 Verbose | Creating ‘c:\inetput\myaccount\Octopus.Features.IISWebSite_BeforePostDeploy.ps1’ from embedded resource
09:07:00 Verbose | Executing 'c:\inetput\myaccount\Octopus.Features.IISWebSite_BeforePostDeploy.ps1’
09:07:00 Verbose | Name Value
09:07:00 Verbose | ---- -----
09:07:00 Verbose | CLRVersion 2.0.50727.5485
09:07:00 Verbose | BuildVersion 6.1.7601.17514
09:07:00 Verbose | PSVersion 2.0
09:07:00 Verbose | WSManStackVersion 2.0
09:07:00 Verbose | PSCompatibleVersions {1.0, 2.0}
09:07:00 Verbose | SerializationVersion 1.1.0.1
09:07:00 Verbose | PSRemotingProtocolVersion 2.1
09:07:00 Verbose | PowerShell Environment Information:
09:07:00 Verbose | OperatingSystem: Microsoft Windows NT 6.1.7601 Service Pack 1
09:07:00 Verbose | OsBitVersion: x86
09:07:00 Verbose | CurrentDirectory: c:\inetput\myaccount
09:07:00 Verbose | CurrentLocation: C:\inetput\myaccount
09:07:00 Verbose | TempDirectory: C:\windows\TEMP
09:07:00 Verbose | HostProcessName: powershell
09:07:00 Verbose | TotalPhysicalMemory: 16735348 KB
09:07:00 Verbose | AvailablePhysicalMemory: 9756584 KB
09:07:00 Verbose | Call to Get-WindowsFeature Web-WebServer failed.
09:07:00 Verbose | Unable to determine if IIS is installed on this server but will optimistically continue.
09:07:00 Info | Making sure a Website “MyAccount” is configured in IIS…
09:07:05 Verbose | Acquired SemaphoreInstance Global\Octopus-IIS-Metabase
09:07:05 Verbose | Loading Application pool
09:07:05 Info | Application pool “DefaultAppPool” already exists
09:07:05 Info | Attempt 1 of 5 failed: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
09:07:05 Info | Waiting for 1 seconds before retrying…
09:07:10 Info | Retrying…
09:07:10 Verbose | Loading Application pool
09:07:10 Info | Application pool “DefaultAppPool” already exists
09:07:10 Info | Attempt 2 of 5 failed: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
09:07:10 Info | Waiting for 1 seconds before retrying…
09:07:10 Info | Retrying…
09:07:10 Verbose | Loading Application pool
09:07:10 Info | Application pool “DefaultAppPool” already exists
09:07:10 Info | Attempt 3 of 5 failed: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
09:07:10 Info | Waiting for 1 seconds before retrying…
09:07:10 Info | Retrying…
09:07:10 Verbose | Loading Application pool
09:07:10 Info | Application pool “DefaultAppPool” already exists
09:07:10 Info | Attempt 4 of 5 failed: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
09:07:10 Info | Waiting for 1 seconds before retrying…
09:07:10 Info | Retrying…
09:07:10 Verbose | Loading Application pool
09:07:10 Info | Application pool “DefaultAppPool” already exists
09:07:10 Info | 0
09:07:10 Error | Get-WebItemState : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACC
09:07:10 Error | ESSDENIED))
09:07:10 Error | + CategoryInfo : InvalidOperation: (Microsoft.IIs.P…rationAttri
09:07:10 Error | bute:ConfigurationAttribute) [Get-WebItemState], UnauthorizedAccessExcepti
09:07:10 Error | on
09:07:10 Error | + FullyQualifiedErrorId : runtimeProperty,Microsoft.IIs.PowerShell.Provide
09:07:10 Error | r.GetItemStateCommand
09:07:10 Verbose | Deleting 'c:\inetput\myaccount\Octopus.Features.IISWebSite_BeforePostDeploy.ps1’
09:07:10 Error | Script ‘c:\inetput\myaccount\Octopus.Features.IISWebSite_BeforePostDeploy.ps1’ returned non-zero exit code: 1
09:07:10 Error | Running rollback conventions…
09:07:10 Verbose | Adding journal entry:
09:07:10 Verbose |
09:07:10 Error | Script ‘c:\inetput\myaccount\Octopus.Features.IISWebSite_BeforePostDeploy.ps1’ returned non-zero exit code: 1
09:07:10 Verbose | Updating manifest with output variables
09:07:10 Verbose | Updating manifest with action evaluated variables
09:07:10 Verbose | Planning retention policy
09:07:10 Fatal | The remote script failed with exit code 1
09:07:10 Verbose | at Octopus.Worker.Scripting.ScriptResult.EnsureSuccessful() in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Worker\Scripting\ScriptResult.cs:line 97
| at Octopus.Server.Orchestration.Deploy.Package.PackageActionHandler.Execute(ActionCommand command, Machine machine) in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Orchestration\Deploy\Package\PackageActionHandler.cs:line 38
| at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.<>c__DisplayClass28_0.b__0() in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 324
| at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.ExecuteWithTransientErrorDetection(Action action, Machine machine) in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 428
| at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.ExecuteActionAndInitLoggingContext(PlannedStep step, Machine machine, PlannedAction action) in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 321
09:07:10 Fatal | Deploy on LocalDev
|
| Canceled: Step 5: Go online
09:07:10 Verbose | Step “Go online” runs only when all previous steps succeeded; skipping
|
| Canceled: Apply retention policy on Tentacles
09:07:10 Verbose | Step “Apply Tentacle Retention Policy” runs only when all previous steps succeeded; skipping

Hello,

Thanks for getting in touch. The error Unable to determine if IIS is installed on this server but will optimistically continue that shows up in the logs may be a hint of a problem whereby IIS isn’t completely set up. Double check that enough IIS related windows server features are installed and enabled, management tools, etc.

The next thing to check is what user the Tentacle service is set to run as, that user will need sufficient privileges to perform actions, it may be set to only have read access at the moment. You could try to log in as that user and perform some of those actions by hand or by running scripts locally to see if they succeed.

Regards,
Nick

Thanks for your prompt reply, I tried to reinstall a full installation of IIS (copy attached), and also the tentacle is running under ‘Local System’ authority, the tentacle installation was run under the same privilege. Still getting the same error, I am going to remove the tentacle altogether and resinstall again, to see if that helps.

Thanks,
ZZ

IIS.PNG

Hello,

The issue still persists, even after removing the tentacle and installing it all again, any suggestions/ideas?

Thanks,
ZZ

Hi ZZ,

Sorry for not getting back sooner that is strange. I think we need to step back and gather more information then. Could you share your step process with us as screen shots and are you running any custom scripts related to the failing steps, if you could share those too we can have a look for what might be causing this problem.

The error might give some more clues, it says Application pool "DefaultAppPool" already exists. Could you also send through the raw log as text file so we have full context, have a look here if you need help finding the part of the UI to download it: https://octopus.com/docs/how-to/get-the-raw-output-from-a-task

Regards,
Nick

Hi Nick,

Thanks for your reply, ok here we go:
For simplicity reasons, created a simple two step process (figure1.png), which ends up with the same issue in step 2. Step 1 “stop website”, is just an inline script and executes successfully, in step 2 (figure2.png…figure5.png) one of the task is to create the app-pool, it does create it but with the wrong version of the framework.

Attached is also the log activity for the entire process.

Thanks,
ZZ

ServerTasks-1047.log.txt (19 KB)

Hi ZZ,

That is strange, could you check a few more things please. Is anything else running on port 8080? Another site on a different app pool? Could you also try and use this community template to stop IIS it has extra checks and retry loop for the stop action:

https://library.octopusdeploy.com/step-templates/9eb40453-ac5d-4cb0-8666-046ff6305a3a/actiontemplate-iis-website-stop

As for the .NET CLR version I see that in it uses 2.0 in your logs, and see that you did specify 4.0 in Octopus. Your screen shot doesn’t show which versions of .NET are installed on the machine, can you go and check that I’ve put in a screen shot of my Windows Features, there’s a 3 sections for .NET; one for 3.5, one for 4.x and they are also mentioned again under Internet Information Services > World Wide Web Services > Application Development Features (see screen shot).

Another thing to try is see how you go without the first step disabling the app pool? It’s more work but you could introduce a “maintenance mode” in the app you’re deploying and have a step that turns it on and back off at the end. That way if a consumer of the app arrived during the deploy they may see a better message (static content).

Regards,
Nick

Hi Nick,

Thanks again for your reply, looks like a problem on my local machine, spent a long time sorting it but with no avail. So, decided to run it on a different machine, all seems to be ok, at least for the test solution.

Once again thanks.
ZZ