xWebAdministration DSCモジュールを使用して静的\動的http圧縮を設定する方法はありますか?限り、私はDSCは、それらを構成する直接的な方法を提供していないが、多分xWebConfigKeyValueはそれを行うことができます理解する?もしそうなら、いくつかの例がありますか?DSCでIISを設定する
そしてまた、この:xIisHandlerで
New-WebHandler -Name "svc-ISAPI-4.0_64bit" -Path "*.svc" -Verb 'GET,POST' -Modules IsapiModule
New-WebHandler -Name "svc-Integrated-4.0" -Path "*.svc" -Verb 'GET,POST' -Modules 'System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
?しかしどのように?
ソリューション:
$mimeTypesDynamic = @(
@{mimeType='text/*'; enabled='True'},
@{mimeType='message/*'; enabled='True'},
@{mimeType='application/x-javascript'; enabled='True'},
@{mimeType='application/json'; enabled='True'},
@{mimeType='application/json; charset=utf-8'; enabled='True'},
@{mimeType='application/xml" enabled'; enabled='True'},
@{mimeType='application/xml; charset=utf-8'; enabled='True'},
@{mimeType='*/*'; enabled='false'}
)
$mimeTypesStatic = @(
@{mimeType='text/*'; enabled='True'},
@{mimeType='message/*'; enabled='True'},
@{mimeType='application/x-javascript'; enabled='True'},
@{mimeType='application/atom+xml'; enabled='True'},
@{mimeType='application/xaml+xml'; enabled='True'},
@{mimeType='*/*'; enabled='false'}
)
...
Script configureMime {
SetScript = {
Remove-WebHandler -Name "svc-Integrated-4.0" -WarningAction SilentlyContinue
Remove-WebHandler -Name "svc-ISAPI-4.0_64bit"
Clear-WebConfiguration -filter "/system.webServer/httpCompression/dynamicTypes" -pspath IIS: -WarningAction SilentlyContinue
Clear-WebConfiguration -filter "/system.webServer/httpCompression/staticTypes" -pspath IIS: -WarningAction SilentlyContinue
foreach ($mimeD in $using:mimeTypesDynamic) {
Add-WebConfiguration "/system.webServer/httpCompression/dynamicTypes" -pspath IIS: -value $mimeD
New-Item c:\1 -ItemType Directory -ea 0
}
foreach ($mimeS in $using:mimeTypesStatic) {
Add-WebConfiguration "/system.webServer/httpCompression/staticTypes" -pspath IIS: -value $mimeS
}
New-WebHandler -Name "svc-ISAPI-4.0_64bit" -Path "*.svc" -Verb 'GET,POST' -Modules IsapiModule
New-WebHandler -Name "svc-Integrated-4.0" -Path "*.svc" -Verb 'GET,POST' -Modules 'System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
}
TestScript = {
$types = Get-WebConfigurationProperty -Filter "/system.webServer/httpCompression" -name dynamicTypes
$types.Collection.Length -eq 8
}
GetScript = { return @{ 'Result' = "Mimi Configuration" } }
}
xIISHandlerのみハンドラの定義済みリストを受け付ける(https://github.com/PowerShell/xWebAdministration/ blob/dev/DSCResources/MSFT_xIIsHandler/MSFT_xIisHandler.psm1)。スクリプトリソースを使用することができます。 –
ok、あなたは圧縮について知っていますか? @FrodeF。 – 4c74356b41
おそらく、xwebconfigkeyvalue(またはスクリプトリソースを使用)が必要になるでしょう。 PowerShellの例を検索して、設定する必要があるパスと値を見つけてください。 –