本来想用 routes.IgnoreRoute ,没找到正确方法。
后面参考了
http://stackoverflow.com/questions/1765726/ignoreroute-in-asp-mvc
Replace:
<httpHandlers>
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>
with:
<httpHandlers>
<add path="*.aspx" verb="*" type="System.Web.HttpNotFoundHandler"/>
<add path="*.master" verb="*" type="System.Web.HttpNotFoundHandler"/>
<add path="*.ascx" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>
真是好使。
改下,改为
<httpHandlers>
<add path="*.json" verb="*" type="System.Web.DefaultHttpHandler"/>
<add path="*.*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>