docker-archive / communitytools-image2docker-win

305 stars 78 forks source link

Generate_IIS : You cannot call a method on a null-valued expression. #56

Open NikitaEgorov opened 7 years ago

NikitaEgorov commented 7 years ago
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:34 char:23
+ ... ockerfile = & "Generate_$Artifact" -MountPath $MountPath -ManifestPat ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Generate_IIS], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull,Generate_IIS
PS C:\> ConvertTo-Dockerfile -ImagePath D:\Win2008r2Std-Gen1_boot.vhdx -Verbose -OutputPath d:\iis2

cmdlet ConvertTo-Dockerfile at command pipeline position 1
Supply values for the following parameters:
Artifact: iis
NikitaEgorov commented 7 years ago

Help me please

sixeyed commented 7 years ago

Hi @NikitaEgorov - can you post some more information please, the whole output of the command would be useful (you can obscure any secret details, it's just the flow of commands I'd like to see).

NikitaEgorov commented 7 years ago

@sixeyed

I have VM image Win2008r2Std-Gen1_boot.vhdx

execute this command PS C:\> ConvertTo-Dockerfile -ImagePath D:\Win2008r2Std-Gen1_boot.vhdx -Artifact IIS -Verbose -OutputPath d:\iis7

And get result

VERBOSE: Reading image file: D:\Win2008r2Std-Gen1_boot.vhdx
VERBOSE: Image file appears to be a valid WIM or VHDX file.
VERBOSE: Image file D:\Win2008r2Std-Gen1_boot.vhdx contains 1 images
VERBOSE: This image appears to be a valid Virtual Hard Drive (VHDX) file.
VERBOSE: Image type is: VHDX
VERBOSE: User didn't specify a mount path. Using:
C:\Users\******\AppData\Local\Temp\463379ac-33d6-4df1-ae5b-4e15d7009233-mount
VERBOSE: Finished mounting image D:\Win2008r2Std-Gen1_boot.vhdx at mount point
C:\Users\*******\AppData\Local\Temp\463379ac-33d6-4df1-ae5b-4e15d7009233-mount
VERBOSE: Finished mounting image to: C:\Users\*******\AppData\Local\Temp\463379ac-33d6-4df1-ae5b-4e15d7009233-mount
VERBOSE: Starting conversion process
VERBOSE: Started discovering IIS artifact
VERBOSE: Checking IIS ApplicationHost config for Windows Version: 6.1
VERBOSE: IIS service is present on the system
VERBOSE: ASP.NET is present on the system
VERBOSE: .NET 3.5 is present on the system
VERBOSE: Finished discovering IIS artifact
VERBOSE: Generating Dockerfile based on discovered artifacts in
:C:\Users\*******\AppData\Local\Temp\463379ac-33d6-4df1-ae5b-4e15d7009233-mount
VERBOSE: Generating result for IIS component
VERBOSE: Copying IIS configuration files
VERBOSE: Writing instruction to create site MyHome
VERBOSE: Processing source directory: C:\inetpub\wwwroot\***\Web
VERBOSE: Creating web app Services
VERBOSE: Processing source directory: C:\inetpub\wwwroot\***\Services
VERBOSE: Finished dismounting the Windows image from
C:\Users\*******\AppData\Local\Temp\463379ac-33d6-4df1-ae5b-4e15d7009233-mount
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:34 char:23
+ ... ockerfile = & "Generate_$Artifact" -MountPath $MountPath -ManifestPat ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Generate_IIS], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull,Generate_IIS
NikitaEgorov commented 7 years ago

@sixeyed

I catch it

Generate_IIS:165

if ($sourcePath -ne $mainVirtualDir.PhysicalPath) {
                    ProcessDirectory -DirectoryBuilder $DirectoryBuilder -CopyBuilder $CopyBuilder -SourcePath $sourcePath                  
                }

AclBuilder is null

andreputera commented 7 years ago

hi @NikitaEgorov , did you find a solution for this issue?

NikitaEgorov commented 7 years ago

@andreputera Yes! See PR #55

andreputera commented 7 years ago

Thanks @NikitaEgorov

andreputera commented 7 years ago

I'm still having the same problems even after adding the "-AclBuilder $AclBuilder" at lines 165 and 192.

andreputera commented 7 years ago

I'm still having the same problems even after adding the "-AclBuilder $AclBuilder" at lines 165 and 192.

Update: I close the powershell prompt and restarted Docker, now it works, no errors. Now trying to build it

pulla2908 commented 7 years ago

I have a possible fix for this. I am creating a PR.

automatecloud commented 7 years ago

Getting the same error:

ConvertTo-Dockerfile -ImagePath D:\disk\DEV-SRV-N1.VHDX -Artifact iis -OutputPath C:\i2d2 -Verbose

Generate_IIS : You cannot call a method on a null-valued expression. At C:\Program Files\WindowsPowerShell\Modules\Image2Docker\1.8.5\Functions\Private\GenerateDockerfile.ps1:34 char:23

How can I fix this?

DanielTheCoder commented 7 years ago

@automatecloud have you applied the patch from @pulla2908, his PR is not yet merged?

automatecloud commented 7 years ago

@DanielTheCoder no, I had this bug during a POC a month ago and the POC is done so far as we did a manual creation of the Dockerfile. So not possible to check if the patch from @pulla2908 will help. I can't confirm that.

sixeyed commented 7 years ago

That's the problem with this issue, I haven't been able to reliably replicate it, so I want to spend some more time with the PR before merging.

DanielTheCoder commented 6 years ago

I see. @pulla2908 were able to reproduce the problem if you have a website with a virtual directory which is not placed under wwwroot. Maybe this helps to reproduce the problem?

cbmdk commented 6 years ago

I have the same config as @DanielTheCoder. my website as virtual applications which are not directly under the wwwroot but in a customers folder another place. And I get the same error :(

jhoward321 commented 6 years ago

Are there any updates on this? I have a site that is not under wwwroot and get the error every time. Looks like the pull requests are just waiting to be merged?

jcchristensen74 commented 6 years ago

I also have this error have edited the Generate IIS PS Script

PS C:\Users\jcchris2> ConvertTo-Dockerfile -Local -Artifact IIS -ArtifactParam 276_277_5010/DEV01 -IncludeWindowsFeature s -OutputPath C:\i2d-out\276 -verbose VERBOSE: Using local drive: C: VERBOSE: Starting conversion process VERBOSE: Started discovering IIS artifact VERBOSE: Checking IIS ApplicationHost config for Windows Version: 6.1 VERBOSE: IIS service is present on the system VERBOSE: ASP.NET is present on the system VERBOSE: .NET 3.5 is present on the system VERBOSE: Finished discovering IIS artifact VERBOSE: Generating Dockerfile based on discovered artifacts in :C: VERBOSE: Generating result for IIS component VERBOSE: Copying IIS configuration files VERBOSE: Skipping site path: Sepy VERBOSE: Skipping site path: 270_271_5010 VERBOSE: Writing instruction to create site 276_277_5010 VERBOSE: Processing source directory: C:\Select Health Services\276 277 5010 VERBOSE: Copying content from source: C:\Select Health Services\276 277 5010, to: C:\i2d-out\276 VERBOSE: Creating web app DEV01 VERBOSE: Processing source directory: C:\Select Health Services\276 277 5010\DEV01 Generate_IIS : You cannot call a method on a null-valued expression. At C:\Program Files\WindowsPowerShell\Modules\Image2Docker\1.8.5\Functions\Private\GenerateDockerfile.ps1:37 char:23

jcchristensen74 commented 6 years ago

It seems any site with a Web Application under it gets the Generate_IIS error, sites with no Web Apps completes and creates a Dockerfile. Is there a workaround to get a site with a Web application to complete and create a Dockerfile?

hreiner commented 6 years ago

Hello, I also had the same issue, and applying the Pr #55 from @NikitaEgorov fixed the problem (thanks by the way). Hadrien

m2f0 commented 5 years ago

Hello. Same error here. Same configuration and same logs. Help, please.

eli7e commented 5 years ago

I'm trying to containerize IIS running on Windows 2008R2 running on vSphere 6.7. My steps are as follows: