diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/CoreStrings.resx b/src/Microsoft.AspNetCore.Server.Kestrel.Core/CoreStrings.resx
index 16e59e4c3..63f8986ab 100644
--- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/CoreStrings.resx
+++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/CoreStrings.resx
@@ -342,4 +342,7 @@
Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.
+
+ Value must be a positive number. To disable a minimum data rate, use null where a MinDataRate instance is expected.
+
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/MinDataRate.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/MinDataRate.cs
index 9d68a7ee9..0e320b37f 100644
--- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/MinDataRate.cs
+++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/MinDataRate.cs
@@ -18,7 +18,7 @@ public MinDataRate(double bytesPerSecond, TimeSpan gracePeriod)
{
if (bytesPerSecond <= 0)
{
- throw new ArgumentOutOfRangeException(nameof(bytesPerSecond), CoreStrings.PositiveNumberRequired);
+ throw new ArgumentOutOfRangeException(nameof(bytesPerSecond), CoreStrings.PositiveNumberOrNullMinDataRateRequired);
}
if (gracePeriod <= Heartbeat.Interval)
diff --git a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Properties/CoreStrings.Designer.cs b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Properties/CoreStrings.Designer.cs
index aa43e6b64..4598adc6f 100644
--- a/src/Microsoft.AspNetCore.Server.Kestrel.Core/Properties/CoreStrings.Designer.cs
+++ b/src/Microsoft.AspNetCore.Server.Kestrel.Core/Properties/CoreStrings.Designer.cs
@@ -1060,6 +1060,20 @@ internal static string SynchronousWritesDisallowed
internal static string FormatSynchronousWritesDisallowed()
=> GetString("SynchronousWritesDisallowed");
+ ///
+ /// Value must be a positive number. To disable a minimum data rate, use null where a MinDataRate instance is expected.
+ ///
+ internal static string PositiveNumberOrNullMinDataRateRequired
+ {
+ get => GetString("PositiveNumberOrNullMinDataRateRequired");
+ }
+
+ ///
+ /// Value must be a positive number. To disable a minimum data rate, use null where a MinDataRate instance is expected.
+ ///
+ internal static string FormatPositiveNumberOrNullMinDataRateRequired()
+ => GetString("PositiveNumberOrNullMinDataRateRequired");
+
private static string GetString(string name, params string[] formatterNames)
{
var value = _resourceManager.GetString(name);
diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests/MinDataRateTests.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests/MinDataRateTests.cs
index 7cc88188a..a87bfa770 100644
--- a/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests/MinDataRateTests.cs
+++ b/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests/MinDataRateTests.cs
@@ -26,7 +26,7 @@ public void BytesPerSecondInvalid(double value)
var exception = Assert.Throws(() => new MinDataRate(bytesPerSecond: value, gracePeriod: TimeSpan.MaxValue));
Assert.Equal("bytesPerSecond", exception.ParamName);
- Assert.StartsWith(CoreStrings.PositiveNumberRequired, exception.Message);
+ Assert.StartsWith(CoreStrings.PositiveNumberOrNullMinDataRateRequired, exception.Message);
}
[Theory]