【问题标题】:Set default webpage in vb.Net web-project在 vb.Net web-project 中设置默认网页
【发布时间】:2015-08-01 12:18:57
【问题描述】:

我的网络项目中有一个类 api 和一个功能测试。要调用此函数,我在浏览器中键入链​​接http://localhost/api/test。现在我的问题是可以调用默认页面,例如 index.html,如果我只调用没有函数的类,例如:http://localhost/api

“我不使用 ASP.Net”

【问题讨论】:

  • stackoverflow.com/questions/1125280/… 查看第二种解决方案——只需右键单击您要设为默认的文件,然后选择“设为起始页”
  • 感谢您的回复。此解决方案仅适用于 Visual Studio 中的服务器,但我将在外部 IIS 上使用它。
  • IIS 设置具有默认页面配置。见technet.microsoft.com/en-us/library/cc753615%28v=ws.10%29.aspx
  • 我已经尝试过了,但它对我不起作用。我认为原因是 Index.html 在应用程序文件夹中,但站点必须保留在那里。

标签: vb.net default webpage web-project


【解决方案1】:

我在 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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-19
    • 1970-01-01
    • 2012-08-21
    • 2022-03-07
    相关资源
    最近更新 更多