IIS7 deploy nested site fails

Have been struggling to get Octopus to deploy a website to a sub-domain. Standard deploy as a stand-alone site on the same server works fine. So I have one project which deploys to the main site “CrewApp” and then I need to install another project as a sub-site so that we can use single sign-on form cookies this needs to be “CrewApp/ClassicWeb”

Sending and extracting the packages to a custom folder works fine. The only thing which I cannot get to work is to add the the application as a sub-site of CrewApp (if it does not yet exist)

Have tried the following approaches but all failed.

  1. With “IIS web site and application pool” feature (like CrewApp) but that does not support installing as a sub-folder (tells me that I should use home directory feature the moment I enter a / character)
  2. With “IIS6+ home directory” feature, but this does not work either
  3. Tried with separate powershell template “IIS Virtual Directory - Create”, but that fails if the folder already exists (because of earlier deploy). So on second deploy this goes haywire. Do not seem to be able to do a conditional deploy step? Have tried it before and after the other nuget step but if any step fails the whole deployment fails it seems.

I’m a total newby to powershell scripting so was enjoying Octopus very much. However, how come that an apparently simple change (in IIS setup at least) causes so much trouble? Now I need to keep the initioal IIS setup for this subsite a manual step which does feel wrong.

Screenshot.png

ServerTasks-2700.log.txt (9 KB)

ServerTasks-2729.log.txt (4 KB)

ServerTasks-2694.log.txt (4 KB)

Hi Theo,

Thanks for getting in touch. You’re right, this is a scenario some Customers use and it is supported by Octopus using a combination of the IIS web site and application pool, the IIS Virtual Directory - Create Script Template you mentioned, and IIS6+ home directory in separate steps.

From reading through your log files I think this combination failed because of the state the previous failure (and any manual changes to IIS) left the Tentacle machine in.

From the log file that I think should have worked ServerTasks-2694.log, I can see for Wingman
The package has already been installed on this machine, so installation will be skipped.

And then for CrewApp
The application or virtual directory 'CrewApp' does not exist

My recommendation would be to get the target IIS Server back into a known state and try again.

Hopefully that helps you get going again!
Mike

Ah I’ve come one step further. The issue seems to be that the create virtual directory creates an IIS virtual directory (i.e. a logical link) whereas I need it to be an IIS application. If I clrear the classicweb folder before deploying then the deploy succeeds but the website does not run. This is logical since a virtual directory is not using its own bin folder and global asax. However, after I turn the virtual directory into an application then consecutive deploys fail because the create VD task fails to notice that the application folder is already there with the right name.

So it now seems that I should use the task “IIS Create Application” instead of “IIS Create Virtual Directory”

Hi Theo,

Sounds like you’re on the right track. If CrewApp is an application, then yes, you need to create it as an IIS Application. Taking a sweeping guess at the specifics of your situation it sounds like you should be able to do something like:

  1. IIS Web Site and Application Pool for the parent site
  2. IIS Create Application for the sub-application
  3. IIS6+ Home Directory to deploy the sub-application package

Let me know how you’re going.
Mike

Indeed Mike, this approach has sorted it out. I had never really realised the difference between IIS virtual directory and application.

Thanks for the support, and on to the next challenge. We are really enjoying Octupus and exploring its features.

Great news Theo.

Happy Deployments!
Mike