简体   繁体   English

HTTP/2 连接错误 (PROTOCOL_ERROR):请求标头太长

[英]HTTP/2 connection error (PROTOCOL_ERROR): Request headers too long

I have a view that should be able to show large string values (~20k chars).我有一个应该能够显示大字符串值(~20k 个字符)的视图。

In the past this value was rendered as a textarea value in a razor *.cshtml page.在过去,此值在 razor *.cshtml 页面中呈现为 textarea 值。 But when I displayed the webpage in firefox, the browser was not loading the page.但是当我在 firefox 中显示网页时,浏览器没有加载页面。 (Don't have got further error description here) (这里没有进一步的错误描述)

I decided not to render the textarea value in the *.cshtml page anymore.我决定不再在 *.cshtml 页面中呈现 textarea 值。 Therefore I've added a script that loads the data via $.get() when the user clicks a button.因此,我添加了一个脚本,该脚本在用户单击按钮时通过$.get()加载数据。

But I'm still unable to deal with the large values..??但我仍然无法处理大值..?? Why is this?为什么是这样? The large value is only treated on the server side - no transmission to the client!大值仅在服务器端处理 - 不传输到客户端! Or am I wrong?还是我错了?

I have turned now the log level (in appsettings.Development.json ) to debug .我现在将日志级别(在appsettings.Development.json中)转为debug

Now I get the following error:现在我收到以下错误:

Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2ConnectionErrorException: HTTP/2 connection error (PROTOCOL_ERROR): Request headers too long.
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.OnHeaderCore(Nullable`1 index, Boolean indexedValue, ReadOnlySpan`1 name, ReadOnlySpan`1 value)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.OnStaticIndexedHeader(Int32 index, ReadOnlySpan`1 value)
   at System.Net.Http.HPack.HPackDecoder.ProcessHeaderValue(ReadOnlySpan`1 data, IHttpHeadersHandler handler)
   at System.Net.Http.HPack.HPackDecoder.ParseHeaderValue(ReadOnlySpan`1 data, Int32& currentIndex, IHttpHeadersHandler handler)
   at System.Net.Http.HPack.HPackDecoder.DecodeInternal(ReadOnlySpan`1 data, IHttpHeadersHandler handler)
   at System.Net.Http.HPack.HPackDecoder.Decode(ReadOnlySequence`1& data, Boolean endHeaders, IHttpHeadersHandler handler)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.DecodeHeadersAsync(Boolean endHeaders, ReadOnlySequence`1& payload)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.ProcessContinuationFrameAsync(ReadOnlySequence`1& payload)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.ProcessFrameAsync[TContext](IHttpApplication`1 application, ReadOnlySequence`1& payload)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.ProcessRequestsAsync[TContext](IHttpApplication`1 application)

I'm using now HttpContext.Session instead of TempData in my controller.我现在在我的TempData中使用HttpContext.Session而不是 TempData。 That's it..而已..

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

相关问题 如何修复来自 Azure 云服务的“HTTP 错误 400。请求标头的大小太长”错误? - How to fix "HTTP Error 400. The size of the request headers is too long" error from azure cloud services? GRPC - HTTP/2 服务器在连接上发送了无效数据。 从 .netcore 3.1 升级到 net5 或 net6 时的 HTTP/2 错误代码“PROTOCOL_ERROR” - GRPC - The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR when upgrading from .netcore 3.1 to net5 or net6 请求 URL 太长 HTTP 错误 414。请求 URL 太长 - Request URL Too Long HTTP Error 414. The request URL is too long HTTP错误414。使用ActionLink的请求URL太长 - HTTP Error 414. The request URL is too long using ActionLink HTTP 400。请求头的大小太长 - HTTP 400. The size of the request headers is too long IIS部署的ASP.NET Core应用程序出现间歇性431请求标头过长的错误 - IIS Deployed ASP.NET Core application giving intermittent 431 Request headers too long error 错误:http查询字符串太长 - Error : http query string is too long HTTP错误414.请求URL太长。 asp.net - HTTP Error 414. The request URL is too long. asp.net Sharepoint在线API返回:HTTP错误400。请求标头字段太长 - Sharepoint online API returns: HTTP Error 400. A request header field is too long .net core 3.1 身份:cookie 创建“请求太长”错误 - .net core 3.1 identity: cookies create a "request too long" error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM