【问题标题】:How to increase textares's limit?如何增加textares的限制?
【发布时间】:2021-05-06 06:45:07
【问题描述】:

我正在使用 Blazor 服务器端进行开发。

当我将大量单词复制并粘贴到 textarea 时,发生了错误Connection disconnected with error 'Error: Server returned an error on close: Connection closed with an error.'。 p>

<textarea rows="3"
          id="textArea1"
          @bind-value="data"
          @bind-value:event="oninput" 
          />

当我复制和粘贴大约 90kb 的数据时发生了错误。但小数据运行良好。

所以我想问你如何增加textarea的限制?或者什么是控制海量数据的最佳方式。

请帮帮我。

【问题讨论】:

  • 可能是因为你限制了行数?尝试去掉它或增加maxlength 属性
  • @Sean 我删除了rows 并添加了maxlength,但是两者都不起作用。
  • When I copied and pasted a lot of words to textarea, the error **Connection disconnected with error 'Error: Server returned an error on close: Connection closed with an error.'** was occurred. Blazor 服务器应用构建在 ASP.NET Core SignalR 之上。正如@SuprabhatBiswal 提到的,您可以尝试增加MaximumReceiveMessageSize 的值。

标签: javascript html asp.net-core .net-core blazor


【解决方案1】:

Startup.cs 下的ConfigureServices 中添加一个选项到AddSignalR 服务。默认情况下,传入的集线器消息大小为 32KB。

services.AddSignalR(options => { options.MaximumReceiveMessageSize = null; });

MaximumReceiveMessageSize 设置为null 表示没有限制。如果您希望限制消息传输的大小,您甚至可以以字节为单位为其设置一个值。详情请查看ASP.NET Core SignalR configuration

【讨论】:

    猜你喜欢
    • 2019-02-09
    • 1970-01-01
    • 1970-01-01
    • 2015-03-26
    • 1970-01-01
    • 2023-02-22
    • 2012-03-08
    • 1970-01-01
    • 2021-09-27
    相关资源
    最近更新 更多