我有以下命令可以使用 PowerShell
将 MIME
类型添加到 IIS
add-webconfigurationproperty //staticContent -name collection -value @{fileExtension='.xpa'; mimeType='application/octet-stream'}
如何在调用 add-webconfigurationproperty
之前先检查 MIME 类型是否存在?
最佳答案
您可以检查以下内容:
if( !((Get-WebConfiguration //staticcontent).collection | ? {$_.fileextension -eq '.xpa'}) ) {
#do something
}
关于Powershell 检查 IIS 中是否存在 MIME,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28431497/