IIS中存在Powershell检查MIME
我得到了以下命令,可以使用IIS中存在Powershell检查MIME,powershell,iis,mime,Powershell,Iis,Mime,我得到了以下命令,可以使用PowerShell将MIME类型添加到IIS add-webconfigurationproperty //staticContent -name collection -value @{fileExtension='.xpa'; mimeType='application/octet-stream'} 在调用添加WebConfiguration属性之前,如何首先检查MIME类型是否存在?您可以通过以下方法进行检查: if( !((Get-WebConfigura
PowerShell将MIME
类型添加到IIS
add-webconfigurationproperty //staticContent -name collection -value @{fileExtension='.xpa'; mimeType='application/octet-stream'}
在调用添加WebConfiguration属性之前,如何首先检查MIME类型是否存在?您可以通过以下方法进行检查:
if( !((Get-WebConfiguration //staticcontent).collection | ? {$_.fileextension -eq '.xpa'}) ) {
#do something
}
您还可以使用以下方法检查是否存在“属性”:
if (!(Get-WebConfigurationProperty //staticContent -Name collection[fileExtension=".xpa"]))
{
Write-Host ".xpa doesn't exist"
}