Errors while creating new DSC pull server
Closed this issue · 8 comments
I'm trying to create a new DSC web pull server following the sample scripts provided at
https://github.com/PowerShell/Whitepapers/blob/master/PullServerCPIG/PullServerCPIG.md
However, I get following errors:
Exception calling "GetSection" with "2" argument(s): "Filename: redirection.config
Error: Cannot read configuration file
"
+ CategoryInfo : NotSpecified: (:) [], CimException
+ FullyQualifiedErrorId : FileNotFoundException
+ PSComputerName : localhost
The property 'OverrideMode' cannot be found on this object. Verify that the property exists and can be set.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : PropertyNotFound
+ PSComputerName : localhost
And, when I try to run the new pull server in browser, I get this error:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.Detailed Error Information:
Module WindowsAuthenticationModule
Notification AuthenticateRequest
Handler svc-Integrated-4.0
Error Code 0x80070021
Config Error This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location
tag with overrideMode="Deny" or the legacy allowOverride="false".
Config File \\?\C:\inetpub\wwwroot\PSDSCPullServer\web.config
Requested URL http://localhost:8080/psdscpullserver.svc
My environment:
Windows 2012 with WMF 5 (latest)
Thanks for your help!
I realized an issue after debugging directly into the shipped psm1 files. I'm not saying this is directly link to my above reported issue but may have some deeper links.
The problem lies under this block:
https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/dev/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.psm1#L562-L583
If user has both IIS and IIS Express installed on his machine, $appHostConfig variable would hold IISExpress' applicationHost.config by default. And if this file doesn't have a location section for $WebSite i.e. PSDSCPullServer then line number 580 poops out.
The real culprit is line number 573
The sample code below does succeeds for IIS and behaves as expected:
$assembly = [System.Reflection.Assembly]::LoadFrom("$env:systemroot\system32\inetsrv\Microsoft.Web.Administration.dll")
$iisHost = new-object Microsoft.Web.Administration.ServerManager "$env:systemroot\system32\inetsrv\config\applicationhost.config"
$appHostConfig = $iisHost.GetApplicationHostConfiguration()
$appHostConfigSection = $appHostConfig.GetSection("system.webServer/security/authentication/anonymousAuthentication", "PSDSCPullServer")
$appHostConfigSection
Here you can see I am brute forcing the correct dll for IIS.
Let me know if I can be of further help.
Sameer
Closing this as per previous comment. If this was closed in error then please reopen or comment.
Hello @johlju .. I tried to deploy a DSC Pullserver on a machine on which IIS and IIS Express are installed and surprisingly I ran into the above described error although the error has been marked as fixed. Shall I open new issue and refer to the old one? Or would you prefer to reopen the old issue #277
I don’t have the permission any longer to reopen this, so only the author or a maintainer can reopen it.
If you have a fix for this, then please send in a PR and reference this issue. If not, you can either wait if the issue is reopened (by one of the above), or open a new issue and reference this issue in the new issue.
@johlju because I already have implemented a working fix, I'll provide an PR without waiting for the reopening of this bug
Tag me in that PR and I can help you review it when I got a chance.