IIS .NET Sub Site

Hi,

I am trying to deploy a sub site in IIS using the deployment tool. the site has its own application pool.
I was hoping to use the “IIS Web Site” and “Custom install directory” options to do this.

I have attached a screen shot of the desired outcome.

Please can you detail how or if this can be done in the latest version.

Many thanks

Doc1.docx (18 KB)

In IIS terms what you’re trying to create isn’t a ‘sub site’ but an application. You can read a bit more about the terms and the difference between a Site, Application, and a Virtual Directory in this IIS.NET article.

Octopus doesn’t directly support Applications or Virtual Directories on IIS 7 from within the package deployment step. Instead they have added some useful step templates to the libarary.

Using step templates this way is a bit of a departure from the previous way of doing things. Instead of including a number of pre-defined options in the package deployment steps you instead put some of the configuration in future steps. There are some tradeoffs involved but it gives you a lot more flexibility.

Because Applications do not require the physical path to be under the physical path of the Site there is no reason to use the “Custom install directory”. Instead, you leave the package in the Octopus tentacle directory and point IIS at that directory.

Create two deployment steps:

  1. Deploy NexusASPNETWebApplication [Deploy a NuGet package]
    In this step you download the appropriate package and do an necessary variable substitutions or config transforms. There is no need to setup the “IIS website” in this step. Your package is dependent on that site but from your shot it looks like it is pre-existing. It should be set up by whatever deploys that site.

  2. Create Web Application [Based off this template]
    On initial deployment this will create the Application and on subsequent deployments it will update the physical path. Your parameters will look something like this:

    Virtual path: NexusASPNETWebApplication

    Physical path: #{Octopus.Action[Deploy NexusASPNETWebApplication].Output.Package.InstallationDirectoryPath} Make sure the custom bindings box is checked

    Application pool: The name of the existing application pool you want to use.

    Parent site: NexusMVC

The ‘Physical path’ parameter is the thing that will point IIS at the octopus path. Even though the physical path will change with each deployment IIS will seamlessly route requests to the correct place.

When i use
#{Octopus.Action[hslogin].Output.Package.InstallationDirectoryPath} for physical path it shows Error.

Is there any other way to declare physical path with its version name for apllication creation.

Hi Harivignesh,

Thanks for reaching out. Could you show us a screenshot of where are you setting this variable and what are you trying to accomplish? If you could also sendyour raw log for us to see the error, that would be great too.

http://docs.octopusdeploy.com/display/OD/Get+the+raw+output+from+a+task

Thanks!

Dalmiro

Hi Harivignesh,

I was having the same problem and I fixed it by re-ordering my steps. I was trying to create the IIS Application before deploying my NuGet package. I switched them around to deploy the NuGet package first and then create the IIS Application and it worked.

Coming in late here, but for someone that doesn’t yet have the application, do I run the create app step first? Basically I am trying to get an application created under Default Web Site. And it won’t be existing like the OPs was.

Thank you for your email. I no longer work for GHX so please direct any queries to Mark Rosten, Director of EU Product Development, at mark.rosten@ghxeurope.commailto:mark.rosten@ghxeurope.com

Hi Greg,

I’m currently creating the IIS app directly under the Default Web Site (no sub sites). My steps include first uploading the NuGet package and then creating the IIS application.

So does that 2nd step create the application and then apply the deployed nuget packet to it? I guess I don’t get how the nuget package step can be run first if there is no site there yet.

Thanks.

The package upload step puts the nuget package on the tentacle machine and extracts its contents. You then create the IIS app and have the physical path set to the folder where the nuget package contents were extracted.

Here is how it works for me. When I deploy my release from Octopus, the package upload step puts the package on my tentacle machine and extracts its contents under the following folder: C:\Octopus\Applications\Alpha\SPSWS\2015.6.15.172113 (where Alpha is the name of my environment in Octopus, SPSWS is the ID of the nuget package, and 2015.6.15.172113 is the version of the nuget package).

After that, I have the IIS application create step. When creating the IIS app, Octopus needs to know the physical path that the IIS app should use. Since you now have a physical path that was created in the previous step, you use that path to create the IIS app. The IIS application create step template asks for 4 things: Virtual Path, Physical Path, Application Pool, and Parent Site. I suggest using the following value for Physical Path:

#{Octopus.Action[Upload package].Output.Package.InstallationDirectoryPath}

where Upload package is the name of your nuget package upload step. This variable will automatically point to the physical path of the nuget package’s extracted contents folder so you don’t have to (and you shouldn’t) hardcode it.

Hope that helps.

So in your package deploy step, you don’t have any IIS configuration selected, right?

Yes, that is correct.

It looks like the package upload step does have a provision to be able to configure IIS but I don’t use it. I create the IIS app in a separate step. Not sure if that is the “right” way to do it but it’s what works for me.

Got it working. Thanks!