HTTP/2 连接错误 (PROTOCOL_ERROR): 请求 headers 太长
HTTP/2 connection error (PROTOCOL_ERROR): Request headers too long
我有一个视图应该能够显示大字符串值(~20k 个字符)。
过去,此值在 razor *.cshtml 页面中呈现为文本区域值。但是当我在 firefox 中显示网页时,浏览器没有加载页面。 (这里没有进一步的错误描述)
我决定不再在 *.cshtml 页面中呈现 textarea 值。因此,我添加了一个脚本,当用户单击按钮时,该脚本通过 $.get()
加载数据。
但我仍然无法处理大值..!?为什么是这样?大值仅在服务器端处理 - 不传输到客户端!还是我错了?
我现在已经将日志级别(在appsettings.Development.json)改为debug。
现在我得到以下错误:
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)
我现在在我的控制器中使用 HttpContext.Session
而不是 TempData
。就是这样..
我有一个视图应该能够显示大字符串值(~20k 个字符)。
过去,此值在 razor *.cshtml 页面中呈现为文本区域值。但是当我在 firefox 中显示网页时,浏览器没有加载页面。 (这里没有进一步的错误描述)
我决定不再在 *.cshtml 页面中呈现 textarea 值。因此,我添加了一个脚本,当用户单击按钮时,该脚本通过 $.get()
加载数据。
但我仍然无法处理大值..!?为什么是这样?大值仅在服务器端处理 - 不传输到客户端!还是我错了?
我现在已经将日志级别(在appsettings.Development.json)改为debug。
现在我得到以下错误:
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)
我现在在我的控制器中使用 HttpContext.Session
而不是 TempData
。就是这样..