asp.net – HTTP ERROR 431 running web apps from Visual Studio – Stack Overflow


I’m trying to debug a web app in Visual Studio (VS), but whenever I run it I get a 431 error regarding request headers being too large. I’m not explicitly sending any large headers, it’s just initial page load, so I’m not sure if this is a VS problem or maybe some caching problem. I’ve tried quite a few common troubleshooting steps but have not been able to resolve this issue so far.

  • This issue began yesterday. I was previously able to debug the application without encountering this issue.
  • Even if all code is identical to the previous state, this issue persists. I even removed the app completely from my machine, did a fresh clone from the remote repo but the problem persists.
  • I’m trying to run a Blazor app, but the problem is not unique to a single app. I tried to run another .NET app from VS that was also previously working, but it now has the same problem. However, I tried creating a brand new app using the VS Blazor template and that runs fine.
  • I have tried deleting all of my browser cookies multiple times, it has not helped. This includes deleting cookies specific to localhost.
  • I tried unregistering all service workers in the browser, it didn’t help.
  • I have tried going into the browser dev tools and deleting indexedDB data, that did not help.
  • I have tried using private browsing, that did not resolve it.
  • I have tried using 3 different browsers – Edge, Chrome, Firefox – the app has the same error in all browsers.
  • I have tried generating a new dev cert with commands dotnet dev-certs https --clean and dotnet dev-certs https --trust. These did not resolve it.
  • I’ve tried using https and http, neither works.
  • This issue persists across different port numbers.
  • I have tried restarting my machine.
  • I’ve tried clean, rebuild, delete obj and bin folders, re-open VS – none of these resolved the problem.
  • Tried editing registry as suggested in this Microsoft article. I doubled the size of the Kerberos MaxTokenSize, it was of no effect.
  • I’m using VS 2022. I tried updating it to the latest stable version, that didn’t make any difference.
  • Checked other SO questions with similar issues, found no solution.

Here is the error shown on the network tab in the browser:
browser dev tools error details

What could be the root cause of this problem and how can I resolve it?

— UPDATE —
After editing the registry item and restarting, I have my app working in 1 web browser. Still looking into the matter…

Leave a Reply

Your email address will not be published. Required fields are marked *