communitytools-image2docker-win icon indicating copy to clipboard operation
communitytools-image2docker-win copied to clipboard

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

Open NikitaEgorov opened this issue 7 years ago • 22 comments

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 avatar Jun 16 '17 13:06 NikitaEgorov

Help me please

NikitaEgorov avatar Jun 20 '17 08:06 NikitaEgorov

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).

sixeyed avatar Jun 20 '17 08:06 sixeyed

@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 avatar Jun 20 '17 08:06 NikitaEgorov

@sixeyed

I catch it

Generate_IIS:165

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

AclBuilder is null

NikitaEgorov avatar Jun 20 '17 13:06 NikitaEgorov

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

andreputera avatar Jul 03 '17 01:07 andreputera

@andreputera Yes! See PR #55

NikitaEgorov avatar Jul 03 '17 08:07 NikitaEgorov

Thanks @NikitaEgorov

andreputera avatar Jul 03 '17 08:07 andreputera

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

andreputera avatar Jul 03 '17 10:07 andreputera

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

andreputera avatar Jul 03 '17 12:07 andreputera

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

pulla2908 avatar Aug 25 '17 10:08 pulla2908

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

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

How can I fix this?

automatecloud avatar Oct 27 '17 15:10 automatecloud

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

DanielTheCoder avatar Nov 30 '17 08:11 DanielTheCoder

@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.

automatecloud avatar Nov 30 '17 13:11 automatecloud

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.

sixeyed avatar Nov 30 '17 15:11 sixeyed

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?

DanielTheCoder avatar Dec 04 '17 07:12 DanielTheCoder

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 :(

cbmdk avatar Dec 05 '17 15:12 cbmdk

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?

jhoward321 avatar May 15 '18 20:05 jhoward321

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

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

jcchristensen74 avatar Aug 08 '18 16:08 jcchristensen74

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?

jcchristensen74 avatar Aug 08 '18 17:08 jcchristensen74

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

hreiner avatar Aug 10 '18 12:08 hreiner

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

m2f0 avatar Jan 07 '19 17:01 m2f0

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

  • convert .vmdk to .vhdx
  • run Image2Docker 1.8.5
  • ConvertTo-Dockerfile -ImagePath I:\cloneVMIIS_3.vhdx -OutputPath I:\container2\ -MountPath C:\Image\ -Artifact IIS -ArtifactParam 'Default Web Site/Asghar' -Force –Verbose
  • in container2 I get the followings:
  • config folder
  • wwwroot folder
  • IIS.json file
  • no DockerFile due to the following error: 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
  • ... ockerfile = & "Generate_$Artifact" -MountPath $MountPath -ManifestPat ...
  • CategoryInfo : InvalidOperation: (:) [Generate_IIS], RuntimeException
  • FullyQualifiedErrorId : InvokeMethodOnNull,Generate_IIS I’d be grateful if you could help me resolve this problem. Many thanks,

eli7e avatar Sep 03 '19 12:09 eli7e