trying to automate the configuration of a website, it is require to setup some environment variables for an netcore application.
I prepared the following script:
$env:sitename="MyApp"
$env:IMAGEDIRECTORYPATH="C:\Temp\Images\"
$env:REDISINSTANCENAME="DEV"
$env:CACHESERVERHOSTIP="192.168.0.1"
$env:QUEUEMACHINENAME="BOG11"
$env:QUEUESALGORITHMSQUEUE="BOG11\private$\Algorithms"
Import-Module WebAdministration
$envVariables = (
@{name='SignalRHub';value="$env:IMAGEDIRECTORYPATH"},
@{name='ApiServerUrl';value="$env:QUEUESALGORITHMSQUEUE"}
)
$envVariables2 = (
@{name='SignalRHub3';value="$env:IMAGEDIRECTORYPATH"},
@{name='ApiServerUrl3';value="$env:QUEUESALGORITHMSQUEUE"}
)
set-WebConfigurationProperty -pspath "MACHINE/WEBROOT/APPHOST/$env:SiteName" -filter "system.webServer/aspNetCore/environmentVariables" -name "." -value $envVariables
set-WebConfigurationProperty -pspath "MACHINE/WEBROOT/APPHOST/$env:SiteName" -filter "system.webServer/aspNetCore/environmentVariables" -name "." -value $envVariables2
I ran the script in Server A, it works perfectly.
then I ran the script in Server B, and I got this:
set-WebConfigurationProperty : The request is not supported. (Exception from HRESULT: 0x80070032)
At line:23 char:1
+ set-WebConfigurationProperty -pspath "MACHINE/WEBROOT/APPHOST/$env:Si ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-WebConfigurationProperty], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.IIs.PowerShell.Provider.SetConfigurationPropertyCommand
set-WebConfigurationProperty : The request is not supported. (Exception from HRESULT: 0x80070032)
At line:24 char:1
+ set-WebConfigurationProperty -pspath "MACHINE/WEBROOT/APPHOST/$env:Si ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-WebConfigurationProperty], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.IIs.PowerShell.Provider.SetConfigurationPropertyCommand
Server B was cloned from Server B.
What could cause this behavior?