Skip to content

xlisModule Uses wrong configuration key/value pairs when adding handler config #305

@andy1547

Description

@andy1547

I'm using Windows Server 2012 R2 64Bit.
I noticed that after the first successful run of the resource I was getting this error:
[[xIisModule]PHPModuleMapping] Adding fastCgi.
Filename:
Error: Cannot add duplicate collection entry of type 'application' with combined key attributes 'fullPath, arguments'
respectively set to 'C:\PHP\php-cgi.exe, '
+ CategoryInfo : NotSpecified: (:) [], CimException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.IIs.PowerShell.Provider.AddConfigu
rationCommand
+ PSComputerName : localhost

The cause of that error is that the handler mapping gets incorrectly added as a managed handler, instead of a module mapping due to a missing Module key/value pair. Renaming the 'Module' key to 'Modules' fixed the issue.

Current Hashtable used by Add-webconfiguration /system.webServer/handlers iis:\ for adding handler:
@{ Name = $Name Path = $RequestPath Verb = $Verb -join ',' Module = $ModuleType ScriptProcessor = $Path }
Producing this xml in applicationHost.config
<add name="PHP-FastCGI" path="*.php" verb="*" scriptProcessor="C:\PHP\php-cgi.exe" />

It should be:
@{ Name = $Name Path = $RequestPath Verb = $Verb -join ',' Modules = $ModuleType ScriptProcessor = $Path ResourceType = 'File' }
Resulting in
<add name="PHP-FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP\php-cgi.exe" resourceType="File" />

Happy to submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe issue is a bug.in progressThe issue is being actively worked on by someone.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions