1. Aaron Jensen
  2. Carbon
  3. Issues
Issue #168 resolved

Cannot import Carbon 2.0 module due to issues with IIS related functionality

Anonymous created an issue

When I import Carbon I get the following errors:

PS C:\Users\hadmin\Desktop\dsc> Import-Module carbon
Multiple ambiguous overloads found for ".ctor" and the argument count: "1".
At C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Functions\Get-IisApplication.ps1:49 
char:5
+     [OutputType([Microsoft.Web.Administration.Application])]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Multiple ambiguous overloads found for ".ctor" and the argument count: "1".
At C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Functions\Get-IisAppPool.ps1:50 char:5
+     [OutputType([Microsoft.Web.Administration.ApplicationPool])]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Multiple ambiguous overloads found for ".ctor" and the argument count: "1".
At C:\Program 
Files\WindowsPowerShell\Modules\carbon\2.0.0\Functions\Get-IisConfigurationSection.ps1:33 char:5
+     [OutputType([Microsoft.Web.Administration.ConfigurationSection])]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Multiple ambiguous overloads found for ".ctor" and the argument count: "1".
At C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Functions\Get-IisMimeMap.ps1:59 char:5
+     [OutputType([Carbon.Iis.MimeMap])]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Multiple ambiguous overloads found for ".ctor" and the argument count: "1".
At C:\Program 
Files\WindowsPowerShell\Modules\carbon\2.0.0\Functions\Get-IisSecurityAuthentication.ps1:38 char:5
+     [OutputType([Microsoft.Web.Administration.ConfigurationSection])]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Multiple ambiguous overloads found for ".ctor" and the argument count: "1".
At C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Functions\Get-IisWebsite.ps1:43 char:5
+     [OutputType([Microsoft.Web.Administration.Site])]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Multiple ambiguous overloads found for ".ctor" and the argument count: "1".
At C:\Program 
Files\WindowsPowerShell\Modules\carbon\2.0.0\Functions\Install-IisApplication.ps1:39 char:5
+     [OutputType([Microsoft.Web.Administration.Application])]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Multiple ambiguous overloads found for ".ctor" and the argument count: "1".
At C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Functions\Install-IisAppPool.ps1:62 
char:5
+     [OutputType([Microsoft.Web.Administration.ApplicationPool])]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Multiple ambiguous overloads found for ".ctor" and the argument count: "1".
At C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Functions\Install-IisWebsite.ps1:67 
char:5
+     [OutputType([Microsoft.Web.Administration.Site])]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

I think this is related to Microsoft.Web.Administration.dll. Carbon depends on version 7.0.0.0 but does not ship with it. Machines that I checked have version 7.9.0.0 in GAC and I think the module tries to load that, but it has a different API.

I can import Carbon only when I manually delete IIS related functions.

Comments (16)

  1. ArturDorochowicz

    It's me who submitted the original issue. Funny thing, Bitbucket lets anonymous users create issues, but not comment on them later.

    I have this issue on two machines (which is all that I tried)

    1. My client machine: Windows 10 Enterprise, IIS not installed, VS 2015 Enterprise installed
    2. Azure VM using stock VS image: VS-2015-Community-AzureSDK-2.7-WS2012R2, this is obviously Windows Server 2012 R2 Datacenter, IIS not installed, VS 2015 installed

    $PSVersionTable for 1:

    Name                           Value
    ----                           -----
    PSVersion                      5.0.10240.16384
    WSManStackVersion              3.0
    SerializationVersion           1.1.0.1
    CLRVersion                     4.0.30319.42000
    BuildVersion                   10.0.10240.16384
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...} 
    PSRemotingProtocolVersion      2.3
    

    $PSVersionTable for 2:

    Name                           Value
    ----                           -----
    PSVersion                      5.0.10514.6
    WSManStackVersion              3.0
    SerializationVersion           1.1.0.1
    CLRVersion                     4.0.30319.42000
    BuildVersion                   10.0.10514.6
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
    PSRemotingProtocolVersion      2.3
    

    I should mention that on the Azure machine I've been playing with Azure DSC Extension. I'm not sure but it may force an update of some components (WMF? - it's all Greek to me).

  2. Aaron Jensen repo owner

    OK. I'm provisioning two VMs to see if I can duplicate. In the meantime, can you get me a PSStackTrace for one of those errors? E.g.

    $Error[0].ScriptStackTrace
    
  3. ArturDorochowicz

    Yes, both. Seems to be the same thing.

    That Microsoft.Web.Administration.dll thing was a completely wild guess, it could be something with VS or I don't know.

    This is from Azure VM with Windows 2012 R2:

    PS C:\Users\hadmin\Desktop\dsc> $Error[0].ScriptStackTrace
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Functions\Install-IisWebsite.ps1: line 1
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Carbon.psm1: line 160
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Carbon.psm1: line 157
    at <ScriptBlock>, <No file>: line 1
    
    PS C:\Users\hadmin\Desktop\dsc> $Error[1].ScriptStackTrace
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Functions\Install-IisAppPool.ps1: line 1
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Carbon.psm1: line 160
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Carbon.psm1: line 157
    at <ScriptBlock>, <No file>: line 1
    
    PS C:\Users\hadmin\Desktop\dsc> $Error[2].ScriptStackTrace
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Functions\Install-IisApplication.ps1: line 1
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Carbon.psm1: line 160
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\carbon\2.0.0\Carbon.psm1: line 157
    at <ScriptBlock>, <No file>: line 1
    
  4. ArturDorochowicz

    Sorry, my bad, didn't notice that the error on Windows 10 is actually different. Pasted below, with stack traces (the listing in the original issue is from Azure VM with Windows 2012R2).

    Windows PowerShell
    Copyright (C) 2015 Microsoft Corporation. All rights reserved.
    
    C:\Windows\system32
    λ Find-Module -Name Carbon
    
    Version    Name                                Repository           Description
    -------    ----                                ----------           -----------
    2.0.0      Carbon                              PSGallery            Carbon is a PowerShell module for automating the...
    
    
    C:\Windows\system32
    λ Install-Module -Name Carbon
    
    You are installing the module(s) from an untrusted repository. If you trust this repository, change its
    InstallationPolicy value by running the Set-PSRepository cmdlet.
    Are you sure you want to install software from 'https://www.powershellgallery.com/api/v2/'?
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y
    
    C:\Windows\system32
    λ Import-Module Carbon
    Unable to find type [Microsoft.Web.Administration.Application].
    At C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Functions\Get-IisApplication.ps1:15 char:1
    + function Get-IisApplication
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (Microsoft.Web.Administration.Application:TypeName) [],RuntimeExcepti
       on
        + FullyQualifiedErrorId : TypeNotFound
    
    Unable to find type [Microsoft.Web.Administration.ApplicationPool].
    At C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Functions\Get-IisAppPool.ps1:15 char:1
    + function Get-IisAppPool
    + ~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (Microsoft.Web.A...ApplicationPool:TypeName) [], RuntimeException
        + FullyQualifiedErrorId : TypeNotFound
    
    Unable to find type [Microsoft.Web.Administration.ConfigurationSection].
    At C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Functions\Get-IisConfigurationSection.ps1:15 char:1
    + function Get-IisConfigurationSection
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (Microsoft.Web.A...gurationSection:TypeName) [], RuntimeException
        + FullyQualifiedErrorId : TypeNotFound
    
    Unable to find type [Carbon.Iis.MimeMap].
    At C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Functions\Get-IisMimeMap.ps1:15 char:1
    + function Get-IisMimeMap
    + ~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (Carbon.Iis.MimeMap:TypeName) [], RuntimeException
        + FullyQualifiedErrorId : TypeNotFound
    
    Unable to find type [Microsoft.Web.Administration.ConfigurationSection].
    At C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Functions\Get-IisSecurityAuthentication.ps1:15 char:1
    + function Get-IisSecurityAuthentication
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (Microsoft.Web.A...gurationSection:TypeName) [], RuntimeException
        + FullyQualifiedErrorId : TypeNotFound
    
    Unable to find type [Microsoft.Web.Administration.Site].
    At C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Functions\Get-IisWebsite.ps1:15 char:1
    + function Get-IisWebsite
    + ~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (Microsoft.Web.Administration.Site:TypeName) [], RuntimeException
        + FullyQualifiedErrorId : TypeNotFound
    
    Unable to find type [Microsoft.Web.Administration.Application].
    At C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Functions\Install-IisApplication.ps1:15 char:1
    + function Install-IisApplication
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (Microsoft.Web.Administration.Application:TypeName) [], RuntimeExcepti
       on
        + FullyQualifiedErrorId : TypeNotFound
    
    Unable to find type [Microsoft.Web.Administration.ApplicationPool].
    At C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Functions\Install-IisAppPool.ps1:15 char:1
    + function Install-IisAppPool
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (Microsoft.Web.A...ApplicationPool:TypeName) [], RuntimeException
        + FullyQualifiedErrorId : TypeNotFound
    
    Unable to find type [Microsoft.Web.Administration.Site].
    At C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Functions\Install-IisWebsite.ps1:15 char:1
    + function Install-IisWebsite
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (Microsoft.Web.Administration.Site:TypeName) [], RuntimeException
        + FullyQualifiedErrorId : TypeNotFound
    
    C:\Windows\system32
    λ $Error[0]
    Unable to find type [Microsoft.Web.Administration.Site].
    At C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Functions\Install-IisWebsite.ps1:15 char:1
    + function Install-IisWebsite
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (Microsoft.Web.Administration.Site:TypeName) [], RuntimeException
        + FullyQualifiedErrorId : TypeNotFound
    
    C:\Windows\system32
    λ $Error[0].ScriptStackTrace
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Functions\Install-IisWebsite.ps1: line 1
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Carbon.psm1: line 160
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Carbon.psm1: line 157
    at <ScriptBlock>, <No file>: line 1
    C:\Windows\system32
    λ $Error[1].ScriptStackTrace
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Functions\Install-IisAppPool.ps1: line 1
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Carbon.psm1: line 160
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Carbon.psm1: line 157
    at <ScriptBlock>, <No file>: line 1
    C:\Windows\system32
    λ $Error[2].ScriptStackTrace
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Functions\Install-IisApplication.ps1: line 1
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Carbon.psm1: line 160
    at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\Carbon\2.0.0\Carbon.psm1: line 157
    at <ScriptBlock>, <No file>: line 1
    
  5. Aaron Jensen repo owner

    How did you get PowerShell 5 on your Windows 2012 R2 compuer? The one I created came with PowerShell 4, and the latest PowerShell 5 production preview won't install on Windows 2012 R2 Datacenter.

  6. ArturDorochowicz

    No idea ;) Like I said, it's a stock Azure image with VS Community 2015 (that is, VS is already in the image - I think it may be available to MSDN subscribers only). I have deployed it with Azure Resource Manager Template and it has DSC Extension enabled with some simple DSC.

    I'm deploying a fresh one now manually, without DSC Extension. Will see if it lands with PS 5.0. I think I can give you access if I can reproduce the problem there - if you are interested. How would I send the credentials then?

    Ok, it landed with PS 4.0, so I guess it's the DSC extension (version 2.7)

    PS C:\Users\ardln> $PSVersionTable
    
    Name                           Value
    ----                           -----
    PSVersion                      4.0
    WSManStackVersion              3.0
    SerializationVersion           1.1.0.1
    CLRVersion                     4.0.30319.42000
    BuildVersion                   6.3.9600.17400
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
    PSRemotingProtocolVersion      2.2
    
  7. Aaron Jensen repo owner

    What do you mean by "deployed it with Azure Resource Manager Template and it has DSC Extension enabled"? How do I do that?

    I wouldn't mind logging in at all. Not sure how to share the password securely. Do youuse Dropbox? SpiderOak? Microsoft Box? Do you use an iPhone (iMessage is secure).

  8. ArturDorochowicz

    I don't know much about Azure Resource Manager Templates, just learning.

    This is like desired state configuration, but for Azure elements: storage accounts, VMs, networks etc. Templates are in JSON. Template for VM can specify extensions - I think these are the same extensions as in the classic model (Service Management API), so things like BGInfo extension, Chef, Puppet, antivirus products, but also Powershell Desired State Configuration extension, so that it immediately applies a DSC on the machine.

    Documentation is here https://azure.microsoft.com/en-us/documentation/articles/resource-group-authoring-templates/

    Example templates are on Github:

    https://github.com/Azure/azure-quickstart-templates

    I'm creating my own template, but the vm template is based on this:

    https://github.com/Azure/azure-quickstart-templates/tree/master/visual-studio-dev-vm

    and DSC usage (and VM as well) is for example here:

    https://github.com/Azure/azure-quickstart-templates/blob/master/dsc-extension-iis-server-windows-vm/azuredeploy.json#L217

    but I have typeHandlerVersion=2.7

    I see I can 'Send message' to you on BitBucket. Hope it's private. I'll send creds in a moment.

  9. Aaron Jensen repo owner

    What's weird is that the error on your Win2012 server is different than on other computers. I logged in, but didn't find anything obvious.

    I just pushed a fix. The Carbon test suite takes about an hour or so to run, once everything is passing, I'll push out version 2.0.1 with the fix.

  10. Log in to comment