diff --git a/build/releasenotes.props b/build/releasenotes.props
index 3ca74df..af40d41 100644
--- a/build/releasenotes.props
+++ b/build/releasenotes.props
@@ -1,7 +1,7 @@
- 1. 修正TriggerParam类中logId的类型和admin 不一致的问题
+ 1. 修改异步方式读取RequestBody
diff --git a/build/version.props b/build/version.props
index 718b186..5a36b1a 100644
--- a/build/version.props
+++ b/build/version.props
@@ -1,5 +1,5 @@
- 2.0.1
+ 2.0.2
diff --git a/samples/ASPNetCoreExecutor/ASPNetCoreExecutor.csproj b/samples/ASPNetCoreExecutor/ASPNetCoreExecutor.csproj
index 0562725..6f62e05 100644
--- a/samples/ASPNetCoreExecutor/ASPNetCoreExecutor.csproj
+++ b/samples/ASPNetCoreExecutor/ASPNetCoreExecutor.csproj
@@ -1,11 +1,10 @@
- netcoreapp2.2
+ netcoreapp3.1
-
2.2.0
diff --git a/samples/ASPNetCoreExecutor/Extensions/XxlJobExecutorMiddleware.cs b/samples/ASPNetCoreExecutor/Extensions/XxlJobExecutorMiddleware.cs
index dea4386..a02166b 100644
--- a/samples/ASPNetCoreExecutor/Extensions/XxlJobExecutorMiddleware.cs
+++ b/samples/ASPNetCoreExecutor/Extensions/XxlJobExecutorMiddleware.cs
@@ -30,9 +30,9 @@ namespace ASPNetCoreExecutor
&& !string.IsNullOrEmpty(contentType)
&& contentType.ToLower().StartsWith("application/json"))
{
-
+
await _rpcService.HandlerAsync(context.Request,context.Response);
-
+
return;
}
diff --git a/samples/ASPNetCoreExecutor/Startup.cs b/samples/ASPNetCoreExecutor/Startup.cs
index 1ae88f9..66735ee 100644
--- a/samples/ASPNetCoreExecutor/Startup.cs
+++ b/samples/ASPNetCoreExecutor/Startup.cs
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.AspNetCore.Server.Kestrel.Core;
namespace ASPNetCoreExecutor
{
@@ -27,12 +28,16 @@ namespace ASPNetCoreExecutor
services.AddSingleton(); // 添加自定义的jobHandler
services.AddAutoRegistry(); // 自动注册
+
+
+ //services.Configure(x => x.AllowSynchronousIO = true)
+ // .Configure(x=> x.AllowSynchronousIO = true);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
- public void Configure(IApplicationBuilder app,IHostingEnvironment env)
+ public void Configure(IApplicationBuilder app,IWebHostEnvironment env)
{
- if (env.IsDevelopment())
+ if (env.EnvironmentName !="Production")
{
app.UseDeveloperExceptionPage();
}
diff --git a/src/DotXxlJob.Core/XxlRestfulServiceHandler.cs b/src/DotXxlJob.Core/XxlRestfulServiceHandler.cs
index 4615549..a068c15 100644
--- a/src/DotXxlJob.Core/XxlRestfulServiceHandler.cs
+++ b/src/DotXxlJob.Core/XxlRestfulServiceHandler.cs
@@ -65,7 +65,7 @@ namespace DotXxlJob.Core
}
try
{
- string json = CollectBody(request.Body);
+ string json = await CollectBody(request.Body);
switch (method)
{
case "beat":
@@ -99,12 +99,12 @@ namespace DotXxlJob.Core
response.ContentType = "application/json;charset=utf-8";
await response.WriteAsync(JsonConvert.SerializeObject(ret));
}
- private string CollectBody(Stream body)
+ private async Task CollectBody(Stream body)
{
string bodyText;
using (var reader = new StreamReader(body))
{
- bodyText = reader.ReadToEnd();
+ bodyText = await reader.ReadToEndAsync();
}
return bodyText;
}