V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
lslqtz
V2EX  ›  问与答

在 IIS 下使用一个 web.config 规则,出现一个很怪的问题(偶尔 500)。

  •  
  •   lslqtz · 2017-01-21 22:37:51 +08:00 · 2607 次点击
    这是一个创建于 2623 天前的主题,其中的信息可能已经有所发展或是发生改变。
    多个程序都有这种现象,可排除程序问题。。,或许是服务端配置的问题?
    curl 结果,似乎只有静态文件(js/css)才会 500 :
    C:\Users\lslqtz>curl -I http://abc.com/content/themes/default/bootstrap/js/bootstrap.min.js
    HTTP/1.1 500 Internal Server Error
    Content-Length: 27822
    Content-Type: application/x-javascript
    Last-Modified: Sat, 14 May 2016 15:49:00 GMT
    Accept-Ranges: bytes
    ETag: "03ebd21f8add11:0"
    Server: Microsoft-IIS/7.5
    X-Powered-By: ASP.NET
    Date: Sat, 21 Jan 2017 14:36:23 GMT

    C:\Users\lslqtz>curl -I http://abc.com/content/themes/default/bootstrap/js/bootstrap.min.js
    HTTP/1.1 200 OK
    Content-Length: 27822
    Content-Type: application/x-javascript
    Last-Modified: Sat, 14 May 2016 15:49:00 GMT
    Accept-Ranges: bytes
    ETag: "03ebd21f8add11:0"
    Server: Microsoft-IIS/7.5
    X-Powered-By: ASP.NET
    Date: Sat, 21 Jan 2017 14:36:25 GMT

    C:\Users\lslqtz>

    附上 IIS 规则:
    <rule name="1" stopProcessing="true">
    <match url="^(.*)$" ignoreCase="false" />
    <conditions logicalGrouping="MatchAll">
    <add input="{HTTP_HOST}" pattern="^abc.com$" />
    <add input="{URL}" pattern="^/abc/" ignoreCase="false" negate="true" />
    </conditions>
    <action type="Rewrite" url="abc/{R:1}" appendQueryString="true" />
    </rule>
    是在 IIS 下直接用.htaccess 转过来的,原规则:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^abc.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/abc/
    RewriteRule ^(.*)$ abc/$1 [L,QSA]
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2272 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 131ms · UTC 16:12 · PVG 00:12 · LAX 09:12 · JFK 12:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.