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

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

Open
NikitaEgorov opened this issue Jun 16, 2017 · 22 comments · May be fixed by #62
Open

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

NikitaEgorov opened this issue Jun 16, 2017 · 22 comments · May be fixed by #62
Assignees
Labels

Comments

@NikitaEgorov
Copy link

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
Copy link
Author

Help me please

@sixeyed
Copy link
Contributor

sixeyed commented Jun 20, 2017

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
Copy link
Author

NikitaEgorov commented Jun 20, 2017

@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
Copy link
Author

@sixeyed

I catch it

Generate_IIS:165

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

AclBuilder is null

@andreputera
Copy link

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

@NikitaEgorov
Copy link
Author

@andreputera
Yes!
See PR #55

@andreputera
Copy link

Thanks @NikitaEgorov

@andreputera
Copy link

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

@andreputera
Copy link

andreputera commented Jul 3, 2017

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
Copy link

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

@pulla2908 pulla2908 linked a pull request Aug 25, 2017 that will close this issue
@automatecloud
Copy link

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?

@DanielTheCoder
Copy link

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

@automatecloud
Copy link

@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
Copy link
Contributor

sixeyed commented Nov 30, 2017

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 sixeyed closed this as completed Nov 30, 2017
@sixeyed sixeyed reopened this Nov 30, 2017
@DanielTheCoder
Copy link

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
Copy link

cbmdk commented Dec 5, 2017

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
Copy link

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
Copy link

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
Copy link

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
Copy link

hreiner commented Aug 10, 2018

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

@m2f0
Copy link

m2f0 commented Jan 7, 2019

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

@eli7e
Copy link

eli7e commented Sep 3, 2019

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,

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

Successfully merging a pull request may close this issue.