我的网络项目中有一个类api和一个功能测试。要调用此函数,请在浏览器中键入链接http://localhost/api/test。现在我的问题是可以调用默认页面,例如index.html,如果我只调用没有像http://localhost/api这样的函数的类?
"我没有使用ASP.Net"
答案 0 :(得分:0)
我在web.config文件中使用以下代码重定向解决了这个问题。
<configuration>
<system.webServer>
<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found">
<add wildcard="*api" destination="/index.htm" />
<add wildcard="*api/" destination="/index.htm" />
</httpRedirect>
</system.webServer>
</configuration>