Asp.net 核心站点在大约 50 个请求后挂起



我使用asp网络核心2.0并面临非常奇怪的行为(至少我在IIS express本地看到它(。我打开网站页面,然后按刷新按钮大约 50 次,网站开始挂起,处理请求大约需要 40 秒。然后在大约 5 分钟的空闲后,我再次刷新页面,一切运行都很快。接下来 ~50 个请求,它再次挂起。我对此感到非常困惑,不知道原因是什么以及如何对其进行故障排除。我从代码中删除了所有内容,只保留了基本代码,它仍然可以重现。

我的启动类如下所示:

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }
    public IConfiguration Configuration { get; }
    // This method gets called by the runtime. Use this method to add services to the container.
    //public void ConfigureServices(IServiceCollection services)
    public IServiceProvider ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();
        return services.BuildServiceProvider();
    }
    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        app.Use(async delegate(HttpContext context, Func<Task> next)
        {
            await next.Invoke();
        });
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
            app.UseBrowserLink();
        }
        else
        {
            app.UseExceptionHandler("/Home/Error");
        }
        app.UseStaticFiles();
        app.UseMvc(routes =>
        {
            routes.MapRoute(
                name: "default",
                template: "{controller=Home}/{action=Index}/{id?}");
        });
    }
}

控制器操作不执行任何操作,它们只是返回 View。在调试中,我经常看到它挂在"等待下一个。Invoke((;" 行(我添加此委托仅用于调试(,但我不确定问题是否完全在执行操作中。

也许有人知道什么原因或我如何对其进行故障排除?

看起来问题以意想不到的方式解决了 - 我更新了Visual Studio,正如我所看到的,IIS也随之更新。

最新更新