Search code examples
iispowershellmimeappcmd

appcmd.exe to add/change mime type for a subdirectory of a website


I read from this link to add mime for IIS 7

appcmd set config /section:staticContent /+"[fileExtension=' .xyz ',mimeType=' application/octet-stream ']"

But if I want to apply the mime settings only to a virtual directory , how to do it ?

Thanks.


Solution

  • I was able to solve the same problem just now by adding my web app's "site name" as a parameter right after "config." Not sure if it's different if your virtual directory is not its own app.

    appcmd set config "My Site Name" /section:staticContent /+"[fileExtension='.xyz ',mimeType='application/octet-stream ']"