Problem deploying web application to IIS

stuart.robinson-vyas's Avatar


13 Jul, 2017 09:23 AM

I have an existing Octopus Deploy setup that deploys several web applications across our servers successfully. I have just set up a new deployment but when I try to deploy the site it gives the following error message:

foreach-object : You cannot call a method on a null-valued expression.
July 12th 2017 14:06:49Error
At C:\Octopus\Applications\DEV\EDWAccess\1.1.6817_4\Octopus.Features.IISWebSite
July 12th 2017 14:06:49Error
_BeforePostDeploy.ps1:86 char:29'

I thought that there was a problem so I played around with it for a while but got the same error every time. As a testing step I cloned an existing project, changed the port number and deployed it only for it to fail for the same reason. I've searched the net quite a bit but all it says is that I need to define bindings, which I have done (see attached image)

I'm a bit stuck because I am deploying code that is already deployed to a machine that is already running the code using a setup where the only difference is the port number it's running on so I can't think of anything else. I've upgraded to version 3.15.4 but it hasn't gone away.

I've attached the raw log of the deployment.

  1. 1 Posted by stuart.robinson... on 13 Jul, 2017 09:24 AM

    stuart.robinson-vyas's Avatar

    I couldn't upload both files at once so here's the image of the binding setup

  2. Support Staff 2 Posted by Matthew Caspers... on 14 Jul, 2017 12:00 AM

    Matthew Casperson's Avatar

    Hi Stuart, thanks for reaching out.

    Can you please enable the settings to write variables to the log file using the instructions at and attach the new log file. These additional variables will aid us in debugging the issue.

    Matt C

  3. 3 Posted by stuart.robinson... on 14 Jul, 2017 07:49 AM

    stuart.robinson-vyas's Avatar

    Thanks for your reply,

    please see the output attached.



  4. Support Staff 4 Posted by Matthew Caspers... on 17 Jul, 2017 02:52 AM

    Matthew Casperson's Avatar

    Hi Stuart, thanks for providing those log files.

    The line of code $bindingString.Split("|") | foreach-object { is being reported as being on line 86 of Octopus.Features.IISWebSite_BeforePostDeploy.ps1. This means that the version of Calamri is quite old - late 2015 was the last version of Calamari that included a version of the Octopus.Features.IISWebSite_BeforePostDeploy.ps1 file with that particular code at line 86.

    08:45:21   Error    |       foreach-object : You cannot call a method on a null-valued expression.
    08:45:21   Error    |       At C:\Octopus\Applications\DEV\EDWAccess\1.1.6817_6\Octopus.Features.IISWebSite
    08:45:21   Error    |       _BeforePostDeploy.ps1:86 char:29
    08:45:21   Error    |       + $bindingString.Split("|") | foreach-object {

    Your Calamri may be out of date, you may have specified a particular build of Calamari be used that is quite old, or you may have included the Octopus.Features.IISWebSite_BeforePostDeploy.ps1 file, overriding the Calamari version.

    If you do a health check you should be able to see the version of Calamari being used. I have included a screenshot as an example.

    Can you please run the health check and paste in the version of Calamari that is being used. We can use this information to work out why such an old script is being run.

    Matt C

  5. 5 Posted by stuart.robinson... on 17 Jul, 2017 09:47 AM

    stuart.robinson-vyas's Avatar

    Hi Matt,

    your message rang some bells and made me remember this ticket:

    from which we were running a version of calamari V3.2.something - the one uploaded onto the ticket.

    I've removed the config and updated the tentacle and it's all working well again.

    Thanks so much for your help


  6. Paul Stovell closed this discussion on 31 Oct, 2017 09:39 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac