搜索
aardio官方社区 门户 查看主题

IIS7 调用 Microsoft.Web.Administration 自动注册MIME

发布者: Jacen.He | 发布时间: 2017-4-15 14:29| 查看数: 585| 评论数: 1|帖子模式

import dotNet;
var appDomain = dotNet.clr().createAppDomain();

var serverManager = appDomain.load("Microsoft.Web.Administration").createInstance("ServerManager");
var config = serverManager.GetWebConfiguration("update.aardio.com");
var staticContent = config.GetSection("system.webServer/staticContent");
var staticContentCollection = staticContent.GetCollection();
var mimeMapElement = staticContentCollection.CreateElement("mimeMap");
mimeMapElement.Item[
"fileExtension"] = ".lzma";
mimeMapElement.Item[
"mimeType"] = "application/x-lzma";
staticContentCollection.Add(mimeMapElement);
serverManager.CommitChanges();

最新评论

手机版|未经许可严禁引用或转载本站文章|站长邮箱|aardio.com|aardio官方社区 ( 皖ICP备09012014号 )

GMT+8, 2017-10-23 05:07 , Processed in 0.187500 second(s), 18 queries , WinCache On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表