@
ytymf 可以了,老哥,在我自己电脑上配成了,多谢!
总结一下就是在 applicationhost.config 下,自己某个站点的配置中添加一个 application 的设置
<application path="/try-this">
<virtualDirectory path="/" physicalPath="C:\Users\User1\Documents\My Web Sites\WebSite1\myfiles" />
</application>
然后在这个文件夹下 C:\Users\User1\Documents\My Web Sites\WebSite1\myfiles 下添加 web.config,期间我遇到了 404.3error,因为我的文件夹中有个.webp 的文件,该拓展名和对应的 mime type 在的 applicationhost.config 默认设置中没有,下面是加上 mimemap 配置成功的 web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<!-- this configuration overrides the FastCGI handler to let IIS serve the static files -->
<handlers>
<clear/>
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />
</handlers>
<staticContent>
<mimeMap fileExtension=".webp" mimeType="image/webp" />
</staticContent>
</system.webServer>
</configuration>