Create virtual directory in IIS Website

Hi,

I have a web application that I deploy to an IIS Website with Octopus v 2.3.6.1385 which is working fine. Now my application needs to have an additional virtual directory in the IIS Website, is this possible to do with Octopus or do I need to have custom PowerShell scripts?

Brgds

Jonas

There is a nice step template for creating a virtual directory in IIS:

Link

Ok, thanks. I haven’t upgraded to a version that supports templates yet but will give it a try when I do.

Brgds

Jonas

Hi,

How can i declare the virtual path and physical path to create IIS Application creation.
i have attach a screen shot.May i known what wrong in this and need to know how to declare virtual path and physical path

Hi Harivignesh,

As per the description on the Library site for the Step Template, the Virtual Path should be in the format myapp or, to create it under a parent /applications/myapp.

Virtual path
#{VirtualPath}
The name of the application to create. For example, to serve an application that will be available at /myapp, enter myapp. To create an application under a parent virtual directory or application, separate with slashes - for example: /applications/myapp

For the Physical Path you can use #{Octopus.Action[ActionName].Output.Package.InstallationDirectoryPath} which will evaluate to the folder where the NuGet package has been extracted to.

Hope that helps!

Thank you and warm regards,
Henrik

Hi Henrik Andersson,

Thanks for your reply.But when i use your method i will get as following error :
How can i fix it

Virtual path: hslogin
Physical path:
#{Octopus.Action[hslogin].Output.Package.InstallationDirectoryPath}
Parent site: Default Web Site
Getting web site Default Web Site
Creating virtual directory 'hslogin’
Attempt 1 of 5 failed: Parameter ‘PhysicalPath’ should point to existing path.
Waiting for 2 seconds before retrying…
Info 11:44:40
Retrying…
Creating virtual directory 'hslogin’
Attempt 2 of 5 failed: Parameter ‘PhysicalPath’ should point to existing path.
Waiting for 2 seconds before retrying…
Info 11:44:42
Retrying…
Creating virtual directory 'hslogin’
Attempt 3 of 5 failed: Parameter ‘PhysicalPath’ should point to existing path.
Waiting for 2 seconds before retrying…
Info 11:44:44
Retrying…
Creating virtual directory 'hslogin’
Attempt 4 of 5 failed: Parameter ‘PhysicalPath’ should point to existing path.
Waiting for 2 seconds before retrying…
Error 11:44:44
Failed to execute command
Error 11:44:44
At C:\Windows\system32\config\systemprofile\AppData\Local\Tentacle\Temp\dc4f9a0
Error 11:44:44
1-2890-4319-a12f-a752c9af2580.ps1:53 char:13
Error 11:44:44

  •             throw <<<<  "Failed to execute command"
    

Error 11:44:44
+ CategoryInfo : OperationStopped: (Failed to execute command:Str
Error 11:44:44
ing) [], RuntimeException
Error 11:44:44
+ FullyQualifiedErrorId : Failed to execute command
Info 11:44:44
Retrying…
Creating virtual directory 'hslogin’
Info 11:44:44

PowerShell exit code: 1

Fatal 11:44:44
PowerShell script returned a non-zero exit code: 1
Tentacle version 2.6.0.778
Info 11:46:12
Tentacle script execution

Hi Harivignesh,

Could you please send through the full deployment log for me so I can investigate why it is unable to find the physical path.

Henrik

Hi Henrik Andersson,

I have attach Raw output for my project.
For your investigate kindly check it.

ServerTasks-443.log.txt (6 KB)

Hi Henrik Andersson,

I explain my project structure. In my project I need to create virtual directory as like
— Default Web Site
1.login
2.main
3.Proj1
4.Proj2

using Octopus Deployment tool.

How can i do this ??

Hi Harivignesh,

Could you please add the following variables to your project:

  • Name: OctopusPrintVariables, Value: true
  • Name: OctopusPrintEvaluatedVariables, Value: true
    and then do another deployment and send me the full deployment log for that deployment.

Thank you and warm regards,
Henrik Andersson

Hi Henrik Andersson,

Thanks for your response Its working.

I am having the same issue, what was the resolution?

Do we have the resolution for this?

I don’t think creating a virtual directory under parent site should be created under the same physical path.

If there is a workaround or how to resolve this, please share how to resolve this matter.

Thank you in advance.

Any news about this problem? We are experiencing it with offline deployments. To me it seems that the Physical Path variable is not evaluated at all when using #{Octopus.Action[ActionName].Output.Package.InstallationDirectoryPath}

Same here! Would be nice if someone could explain how the #{Octopus.Action[ActionName].Output.Package.InstallationDirectoryPath} is supposed to be used…

?
Hej!

Jag ?r ledig och ?r tillbaka igen m?ndagen den 31:e augusti. L?mna ett meddelande p? mitt mobilsvar om det ?r n?got br?dskande s? ringer jag tillbaka vid tillf?lle.

Jonas Hilmersson

Ok, I figured it out; The clue is in the ‘ActionName’ of the variable. You need to provide a previous step name for the ‘ActionName’, typically the name of the step that deploys the package to your server.

E.g. if the step for deploying the nuget package is called ‘Deploy NuGet Package’, then the correct variable will be:

#{Octopus.Action[Deploy NuGet Package].Output.Package.InstallationDirectoryPath} 

Note that there is no quotes around the step name.

-kjetil

You can use Octopus.Step.Name system variable to avoid writing the name and worry you about keep it updated.

Yes, if the step for creating a vdir on IIS was the same step as the
deployment step, that would work. But you can’t (as far as I know) use that
to reference an earlier step in the process.

-kjetil