0
如果我取消註釋app.Run(async (context) => ...
部分代碼,我可以在代碼中運行html而不會有任何問題。我正在嘗試使用wwwroot中的index.html作爲默認值。但我得到一個404錯誤。我該如何解決?404錯誤本地主機:8000 asp.Net
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);
}
}