我得到了我想与我的 asp.net5 项目链接的 html 文件 index.html。
我试图在 wwwroot 中添加 index.html 和调试的时候我去 localhost:port/index.html,它向我展示了什么。
有人可以链接到文档或解释怎么办呢?
PS︰ 我使用 visual studio。
配置代码︰
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
app.UseIISPlatformHandler();
app.Run(async (context) =>
{
await context.Response.WriteAsync("test");
});
}
你必须告诉您想要使用静态文件的应用程序。你不需要它在 Web Api 2.0 服务器例如。所以,这是不是默认添加的。在你的 Startup.cs 中添加应用程序。UseStaticFiles()配置方法。
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseIISPlatformHandler();
app.UseStaticFiles();
app.UseMvc();
}