如果我取消注释代码的app.Run(async (context) => ...
一部分,我可以在代码中运行 html 而不会出现任何问题。我正在尝试使用 wwwroot 中的 index.html 作为默认值。但我收到 404 错误。我该如何解决?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.Extensions.DependencyInjection;
namespace TheWorld
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
// app.Run(async (context) =>
//{
// var link = @"<!DOCTYPE html>
// <html>
// <head>
// <title>test</title>
// </head>
// <body>
// <h1>TestFile</h1>
// </body>
// </html>";
// await context.Response.WriteAsync(link);
//});
}
// Entry point for the application.
public static void Main(string[] args) => WebApplication.Run<Startup> (args);
}
}