-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xWebVirtualDirectory Fails to create a virtual directory if it already exists #331
Comments
Thanks for reporting this! Labeled this issue as help wanted so that someone in the community can run with it. |
Hi all, I made some tests xWebVirtualDirectory Services
{
Name = "Services"
Website = "Default Web site"
WebApplication = ""
PhysicalPath = "C:\web\"
Ensure = "Present"
} It creates the virtual directory if not present, update it if needed or do nothing if the VD exists. If you add a WebApplication, if the VD is not present it creates it under Webapplication name (ie /myApp/MyVD), but if this VD exists it throws an error. The problem seems to be in the way the resource test the existence of the virtual directory it uses $virtualDirectory = Get-WebVirtualDirectory -Site $Website `
-Name $Name `
-Application $WebApplication Where it should use something like $virtualDirectory = Get-WebVirtualDirectory -Site $Website `
-Name /$WebApplication/$Name `
-Application May I try to send a solution? |
bump... still hitting this bug. Any progess? Or easy work around? My VD needs to exist under the web app |
Make `Set-TargetResource` switch between `WebApplication` '' and '/' as required by `New-WebVirtualDirectory` and `Remove-WebVirtualDirectory` respectively. Fix dsccommunity#331 Fix dsccommunity#366 Similar to old (2019) pr dsccommunity#533
Make `Set-TargetResource` switch between `WebApplication` '' and '/' as required by `New-WebVirtualDirectory` and `Remove-WebVirtualDirectory` respectively. Fix dsccommunity#331 Fix dsccommunity#366 Similar to old (2019) pr dsccommunity#533
Make `Set-TargetResource` switch between `WebApplication` '' and '/' as required by `New-WebVirtualDirectory` and `Remove-WebVirtualDirectory` respectively. Fix dsccommunity#331 Fix dsccommunity#366 Similar to old (2019) pr dsccommunity#533
Not properly tested Recreated in integration tests: # Only relevant properties included
WebVirtualDirectory WebVirtualDirectory_WithProblem
{
WebApplication = 'DummyApp'
Name = 'dummy'
} <!-- C:\Windows\System32\inetsrv\config\applicationHost.config -->
<site name="WebsiteForVirtualDirectory" id="2" serverAutoStart="true">
<application path="/" applicationPool="DefaultAppPool">
<virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot" />
<virtualDirectory path="/DummyApp/dummy" physicalPath="C:\inetpub\virtualdirectory" />
</application>
<application path="/WebApplication" applicationPool="DefaultAppPool">
<virtualDirectory path="/" physicalPath="C:\inetpub\webapp" />
</application> # Only relevant properties included
# This results in identical applicationHost.config, but does NOT have the problem
WebVirtualDirectory WebVirtualDirectory_WorksFine_1
{
WebApplication = ''
Name = 'DummyApp/dummy'
}
# This puts the VirtualDirectory under the application "/WebApplication" in applicationHost.config
# This does NOT have the problem
WebVirtualDirectory WebVirtualDirectory_WorksFine_2
{
WebApplication = 'WebApplication'
Name = 'dummy'
} |
xWebVirtualDirectory Services
{
Name = "Services"
Website = $Node.WebsiteName
WebApplication = $WebApplication
PhysicalPath = "F:\docs\tfs"
Ensure = "Present"
DependsOn = '[xWebsite]NewWebSite'
}
Desired Behavior : The resource should detect the virtual directory exists, and skip it.
*Actual Behavior: It attempts to create the virtual directory, and throws an error saying to use the 'force' parameter.
Error :
VERBOSE:[SERVERNAME]: [[xWebVirtualDirectory]Services] Creating new Web Virtual Directory "Services".
Destination element already exists, please use "force" parameter to override.
+ CategoryInfo : InvalidArgument: (:) [], CimException
+ FullyQualifiedErrorId : Destination element already exists, please use "force" parameter to override.,Microsoft.IIs.PowerShell.Provider.NewVirtualDirectoryCommand
The text was updated successfully, but these errors were encountered: