我们正在为自己的应用程序提供文件,以便从包括IIS在内的Web服务器下载。 一个这样的文件具有.config扩展名。 事实certificate,IIS不会为此服务,因为它认为它是它自己的configuration文件。 我正在考虑只使用。configuration。 这会好吗? 有没有从IIS服务的“禁止”扩展名列表?
是的,有一个阻止名为请求过滤的扩展名列表,你可以运行:appcmd list config -section:system.webServer / security / requestFiltering你会看到类似于:…
在我的Windows 7机器中,列表包括:
.asa,.asax,.ascx,.master,.skin,.browser,.sitemap,.config,.cs,
.csproj,.vb,.vbproj,.webinfo,.licx,.resx,.resources,.mdb,.vjsproj,
.java,.jsl,.ldb,.dsdgm,.ssdgm,.lsad,.ssmap,.cd,.dsprototype,
.saprototype,.sdm,.sdmDocument,.mdf,.ldf,.ad,.dd,.ldd,.sd,
.adprototype,.lddprototype,.exclude,.refresh,.compiled,.msgx,.vsdisco
请注意,您也可以在您的应用程序中指定更多的扩展名,或者允许其他扩展名,这些扩展名可能不会在您的文件夹中使用web.config。
警告不要这样做,因为.config文件可能包含敏感信息。
例如,如果您在应用程序中放置了一个web.config文件,则会让用户下载.config文件:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <security> <requestFiltering> <fileExtensions> <remove fileExtension=".config" /> </fileExtensions> </requestFiltering> </security> </system.webServer> </configuration>
有关更多信息,请参阅: http : //www.iis.net/configReference/system.webServer/security/requestFiltering
最后,如果你要使用一些随机的扩展名,你需要确保IIS也知道使用什么types的MIME,并知道你将使用的扩展名,如果你想允许静态文件下载,那需要在staticContent部分(appcmd列表configuration – 部分:system.webServer / staticContent)。 你也可以像上面那样在web.config里configuration这个。
你可以只是.zip所有的文件,然后你可以服务任何扩展你想要的。