lslqtz
V2EX  ›  问与答

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

  •  
  •   lslqtz · Jan 21, 2017 · 2942 views
    This topic created in 3407 days ago, the information mentioned may be changed or developed.
    多个程序都有这种现象,可排除程序问题。。,或许是服务端配置的问题?
    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]
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2540 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 16:00 · PVG 00:00 · LAX 09:00 · JFK 12:00
    ♥ Do have faith in what you're doing.