Unable to deploy website using IIS web site and application pool feature when using HTTPS binding

I have seen some posts similar to mine where users are unable to deploy a website using the “IIS web site and application pool” feature from octopus deploy when they have a HTTPS binding in the deployment step.

The error seems to occur when running the powershell script: Octopus.Features.IISWebSite_BeforePostDeploy.ps1

However, other users posts seem to occur during the section of the script where it searches for the SSL certificate in the certificate store.

$wsbindings | where-object { $_.protocol -eq "https" } | foreach-object {

My issue is a little different in that it fails in the section above the certificate bind:

 # Each binding string consists of a protocol/binding information (IP, port, hostname)/SSL thumbprint/enabled/sslFlags
 # Binding strings are pipe (|) separated to allow multiple to be specified
$bindingString.Split("|") | foreach-object {
    $bindingParts = $_.split("/")
	$skip = $false
	if ($bindingParts.Length -ge 4) {
		if (![String]::IsNullOrEmpty($bindingParts[3]) -and [Bool]::Parse($bindingParts[3]) -eq $false) {
			$skip = $true
		}
	}

I have not been able to find other posts failing at this specific section of the script.

The error I receive in the build log is as follows:

foreach-object : Exception calling "Parse" with "1" argument(s): "String was 
not recognized as a valid Boolean."
At D:\Octopus\Applications\.SQ-KEN-DEV-IS033-6625FB14\Octopus.Tentacle\2.6.0.77
8\Scripts\Octopus.Features.IISWebSite_BeforePostDeploy.ps1:86 char:29
+ $bindingString.Split("|") | foreach-object {
+                             ~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [ForEach-Object], MethodInvoca 
   tionException
    + FullyQualifiedErrorId : FormatException,Microsoft.PowerShell.Commands.ForEachObjectCommand
PowerShell script returned a non-zero exit code: 1

In my deployment step I have both an HTTP and HTTPS binding. If I leave just the HTTP binding in the deployment step, the website will deploy successfully. If I add in the HTTPS binding, or if I have only the HTTPS binding, the step will fail.

Version Information:
Tentacle version (x64): 2.5.11.614
Octopus Deploy version: 2.6.0.778
Client OS: Windows Server 2012 R2 Std
Octopus Server OS: Windows Server 2012 R2 Std

Hi Jeff,

Thanks for getting in touch! Could you please provide a screenshot of your binding when set to https.
Please feel free to mark this thread as private or send it through to support at octopusdeploy dot com

Vanessa

Attached is the screenshot you requested. I can tell you that I have replaced the HostHeader variable with the actual host header. I also have verified the SSL cert thumbprint matches the cert in the computer Personal store on the machine this is deploying to.

Hello,

I went ahead and added the screenshot you requested to the forum discussion.

Thanks!

Hi Jeff,

Thanks for that! See how SNI is listed as undefined? This is causing the error. If you could delete that record (you can’t edit it to fix it) and re-make it, the SNI should not be listed as undefined and your bindings should work.

Let me know how this goes.
Vanessa

That seems to have fixed the issue.

Thank you for the assistance!

I have the same error, also using Octopus Deploy version 2.6.0.778, but deleting the binding record and re-adding it did not fix the issue.

Hi James

Are you able to post a screenshot of your http bindings as well ?

Thanks

Damian

Hi Damien,

I think the problem turned out to be that I was trying to use the same release. Once I re-added the binding AND created a new release to promote to that environment, it worked.

Thanks,

Ryan

Whoops, sorry for the name misspelling, Damian :slight_smile:

Happens all the time :slight_smile:

Glad you got it sorted out, you’re right we snapshot the release process and variables, creating a new release will fix that.

Damian

I had the same issue. I saw this post so deleted the HTTPS binding and re-created but same problem occurred. The SNI kept displaying as “undefined”. I eventually checked the SNI checkbox saved it then unchecked the box saved again and it resolved the issue. Using version: 2.6.0.778

Update: If you check the SNI checkbox and uncheck it again when first setting up it seems to work as well and it doesn’t display the “undefined”. Seems to be a bug though.

Hi Conrad

I’ve not been able to reproduce this, are you able to walk me through the exact steps ?

Thanks

Damian

Hi Damian,

           Sure, so I’d like to add a new Https binding to my API or website

[cid:image002.jpg@01D04773.97E569F0]

I click “+ Add binding”

I enter the following details…

[cid:image004.jpg@01D04773.97E569F0]

I click save and everything looks Ok

[cid:image006.jpg@01D04773.97E569F0]

I click “Save” on the step and then re-open the Step and I have the “(SNI): undefined” displayed.

[cid:image012.jpg@01D04773.97E569F0]

This causes the following error:
[cid:image013.jpg@01D04773.97E569F0]

It seems a simple check and uncheck of the SNI checkbox during setup seems to get round this issue.

Seems like there is a NULL when the bindings page is displayed but a Boolean True/False on the checkbox which is required.

Hope this helps

Cheers

Conrad

image013.jpg

image012.jpg

image006.jpg

image004.jpg

Argh! Now I see it.

Thanks for the steps, have added a github issue for it here https://github.com/OctopusDeploy/Issues/issues/1478 and will get a fix out really soon.

Thanks Damian, appreciated. Glad I could help.

Got the same error (SNI Undefined). Could fix it with the help from above. Thank you very much!

Still getting this error. SNI is not undefined, running 2.6.2.845.