找不到网址的网页:http:// localhost:64256 / Registration.html

时间:2018-12-10 05:50:23

标签: asp.net-core-2.1

我有一个asp.net core 2.1应用程序,我在其中编写了一些API。现在,在相同的解决方案中,我添加了一个html页面来测试API,

enter image description here

我还将启动浏览器设置更改为html页。现在,当我尝试浏览页面时,我在浏览器中遇到错误,

  

未找到以下网址的网页:http://localhost:64256/Registration.html

我可以这样做吗,我是否缺少任何设置?谢谢!

1 个答案:

答案 0 :(得分:2)

静态文件应添加到wwwroot

在.net核心中,您必须启用静态文件。您可以通过在Startup类的Configure方法中将UseStaticFiles()添加到应用程序构建器中来实现。

Startup.cs:

public void Configure(IApplicationBuilder app)
{
    app.UseStaticFiles();
}
相关问题