Skip to content
This repository has been archived by the owner on Mar 11, 2020. It is now read-only.

Handle IIS WebSites with multiple Web Applications #24

Open
sixeyed opened this issue Dec 5, 2016 · 6 comments
Open

Handle IIS WebSites with multiple Web Applications #24

sixeyed opened this issue Dec 5, 2016 · 6 comments
Assignees
Labels
Milestone

Comments

@sixeyed
Copy link
Contributor

sixeyed commented Dec 5, 2016

Currently this breaks in Generate_IIS, but we need to extend Discover_IIS and the artifact JSON to allow for multiple Web Apps under one Web Site. Sample applicationHost.config:

<sites>
            <site name="Default Web Site" id="1">
                <application path="/">
                    <virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" />
                </application>
                <application path="/WebApplication1" applicationPool="DefaultAppPool">
                    <virtualDirectory path="/" physicalPath="C:\scm\github\sixeyed\IisConsoleLog\WebApplication1" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:80:" />
                </bindings>
            </site>
...

The solution also needs to support the same setup in Metabase.xml configuration.

We should support three scenarios:

1 - allow a specific web app to be extracted from a VM. E.g. in the above sample we have the website called Default Web Site which contains an app called WebApplication1. Users should be able to extract just that app into the Dockerfile with -Artifact IIS -ArtifactParam 'Default Web Site/WebApplication1'

2 - If a website but not a web app is specified as a parameter, extract all the web apps in the website into the Dockerfile, e.g. -Artifact IIS -ArtifactParam 'Default Web Site'

3 - if no artifact parameter specified, preserve the existing IIS setup - bringing all websites and all web apps into the Dockerfile, e.g. -Artifact IIS

@sixeyed sixeyed modified the milestones: 1.7, 1.8 Dec 5, 2016
@sixeyed sixeyed added P1 and removed P2 labels Jan 30, 2017
@sixeyed sixeyed self-assigned this Feb 9, 2017
@sixeyed
Copy link
Contributor Author

sixeyed commented May 3, 2017

Fixed in 1.8

@sixeyed sixeyed closed this as completed May 3, 2017
@BrazilPowered
Copy link

Hey sixeyed, I'm using version 1.8.2, and I get a crash each time I try to run this:
ConvertTo-Dockerfile -RemotePath \\IP.add.res.s1\c$ -Verbose -OutputPath C:\i2d2\folder -Artifact IIS -ArtifactParam "Default Web Site/Application_NAME"

It yields this error:

Generate_IIS : You cannot call a method on a null-valued expression.
At C:\WINDOWS\system32\docker\communitytools-image2docker-win\Functions\Private\GenerateDockerfile.ps1:37 char:23
+ ... ockerfile = & "Generate_$Artifact" -MountPath $MountPath -ManifestPat ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Generate_IIS], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull,Generate_IIS

The same goes for using -Local instead of -RemotePath. I also get the same error if I don't include any -ArtifactParam for both -Local and -RemotePath

The only thing that seems to work with either is changing the -ArtifactParam to iis-env, in which case I only get the IIS services, and none of the websites. Though I do see the application appear in the resulting applicationHost.config.

Can you help me figure out if I'm missing something, or if this might be a similar issue? It might be important to note that the application I'm looking at resides under the Default Web Site under "Default Web Site/Application_NAME"?

@dvsergeenko
Copy link

Hey! I'am using 1.8.2 too and experiencing the same issue then trying to convert .vhd image with multuple IIS sites on it.
Generate_IIS : You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\Image2Docker\1.8.2\Functions\Private\GenerateDockerfile.ps1:37 char:23

  • ... ockerfile = & "Generate_$Artifact" -MountPath $MountPath -ManifestPat ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [Generate_IIS], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull,Generate_IIS

@ManoMarks ManoMarks reopened this Jun 16, 2017
@bspann
Copy link

bspann commented Oct 20, 2017

I am getting the same thing using 1.8.5 by running the following command: ConvertTo-Dockerfile -ImagePath "D:\Virtual Machines\Windows Server 2008\Virtual Hard Disks\Windows Server 2008.vhdx" -Artifact IIS -ArtifactParam 'Default Web Site/JSSK' -OutputPath C:\website\IIS -Verbose

Not only am I getting the error but the website directory it copies out is not the correct one in the VM.

@beigewell
Copy link

I also have this issue has anyone found a workaround? I have tried looking into the Generate IIS ps1 but nothing seems out of the ordinary. I have multiple sites this doesnt work with when trying local or vhdx source.

@beigewell
Copy link

fix usage of ProcessDirectory #62 has worked for most of my sites

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants