【发布时间】:2017-03-31 12:26:04
【问题描述】:
我尝试使用 dotnet core web api 构建一个 web 应用程序,但我不知道如何将 index.html 设置为起始页,这可以通过 dotnet framework web api 轻松完成。我尝试使用app.UseDefaultFiles();app.UseStaticFiles(); 来解决这个问题,但是没有成功。
【问题讨论】:
-
index.html 在哪里?在 wwwroot 文件夹或项目根目录?
-
@ademcaglin wwwroot.i 通过在浏览器中键入正确的 url 解决了这个问题。当我启动应用程序时,浏览器将以 ip:portnumber/api/values 之类的 url 开头,我忽略了它.just app.UseDefaultFiles();app.UseStaticFiles();没问题。
标签: asp.net-web-api asp.net-core .net-core