使用C#试图获取位于共享网络驱动器中的文件以使IIS 10遇到麻烦。
web.config中有一堆规则(目前有许多实验性规则),但似乎根本没有起作用。
<preConditions>
<preCondition name="Excel Example">
<add input="{HTTP_USER_AGENT}" pattern="Trident" negate="true" />
</preCondition>
</preConditions>
<!-- Sample rules -->
<rule name="test excel" enabled="true" stopProcessing="true">
<match url=".*.xlsx" />
<action type="Rewrite" url="site/{R:0}" />
</rule>
<rule name="File Downloads" enabled="true" stopProcessing="true">
<match url=".*netdrive(.*)" />
<action type="Rewrite" url="site/{R:3}" />
</rule>
甚至出站规则:
<rule name="Allow xlsx to be downloaded" preCondition="Excel Example">
<match serverVariable="RESPONSE_Content_Disposition" pattern=".*netdrive(.*)" negate="false" />
<action type="Rewrite" value="https://samplesite.org/netdrive/{R:1}" />
</rule>
<rule name="Allow xlsx to be downloaded2" preCondition="Excel Example">
<match serverVariable="RESPONSE_Content_Disposition" pattern=".*[\/\\]netdrive[\/\\](.*)" negate="false" />
<action type="Rewrite" value="https://samplesite.org/netdrive/{R:1}" />
</rule>
.xlsx文件上完全没有匹配项。我得到的404最多为http://,但只有404屏幕...
Requested URL http://localhost:80/netdrive/Subfolder1/File.xlsx
Physical Path C:\inetpub\wwwroot\netdrive\Subfolder1\File.xlsx
尽我的智慧。有什么想法吗?