Question

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.

Was it helpful?

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 ']"

OTHER TIPS

The appcmd syntax to add a mime type for a specific folder is like this

appcmd set config "Default Web Site/MyFolder" /section:staticContent /+"[fileExtension='.* ',mimeType='application/octet-stream ']"

to remove a mime type for a specific folder (/- instead of /+)

appcmd set config "Default Web Site/MyFolder" /section:staticContent /-"[fileExtension='.* ',mimeType='application/octet-stream ']"

Change "Default Web Site" to the name of your website

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top