简体   繁体   English

ASP.NET Core 2.0。 错误的启动文件

[英]ASP.NET Core 2.0. Wrong startup file

I had the "index.html" file and it started as a startup file by default with the following code 我有“ index.html”文件,默认情况下它使用以下代码作为启动文件启动

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    app.UseDefaultFiles();
    app.UseStaticFiles(); 
}

Then I removed the "index.html" file from my project but it still starts as the startup file even though my code now is 然后,我从项目中删除了“ index.html”文件,但即使现在的代码是

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    app.Run(async (context) =>
    {
        await context.Response.WriteAsync("Hello world");
    }); 
}

I have restarted my Visual Studio and rebuilt the project but this didn't help. 我重新启动了Visual Studio并重建了项目,但这无济于事。 What might be the problem? 可能是什么问题?

It could be that you still have index.html in the wwwroot folder. 可能是您在wwwroot文件夹中仍然有index.html Try removing it there first and then restart your application. 尝试先将其删除,然后重新启动应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM