asp.net核心ajax获取

I am making a simple jquery ajax get request. The first request works great. However, any subsequent returns the error 431 (Request Header Fields Too Large). It seems asp.net core is adding the headers that are quite large (see pic)

How do I resolve this issue?

Thanks in advance for the help![enter image description here]1

By default, TempData uses a cookie-based provider, which means each piece of data you add goes out as a cookie. It looks like you've added so much here that the header is now too large. The easiest solution is to use session state as a TempData provider, instead. Then, you'll just have one session cookie going out, regardless of how much data you set in TempData. In ConfigureServices add:

services.AddMvc()
    .SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
    .AddSessionStateTempDataProvider();

services.AddSession();

And then in Configure:

app.UseSession();
app.UseMvc();

You'll like also want to configure session to use a persistent store like Redis or SQL Server, rather than the default of in-memory, but that's not directly relevant to the use of TempData.