diff --git a/HttpClientStudy.WebApp/Controllers/AdvancedGetController.cs b/HttpClientStudy.WebApp/Controllers/AdvancedGetController.cs
new file mode 100644
index 0000000..df5bb05
--- /dev/null
+++ b/HttpClientStudy.WebApp/Controllers/AdvancedGetController.cs
@@ -0,0 +1,43 @@
+using System.Text;
+
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+
+namespace HttpClientStudy.WebApp.Controllers
+{
+ ///
+ /// 高级Get请求 控制器
+ ///
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+ public class AdvancedGetController : ControllerBase
+ {
+ private ILogger _logger;
+
+ ///
+ /// 构造
+ ///
+ public AdvancedGetController(ILogger logger)
+ {
+ _logger = logger;
+ }
+
+ ///
+ /// 带请求体数据的Get请求
+ /// (asp.net 3开始,默认不允许Get有Body)
+ ///
+ ///
+ [HttpGet]
+ public async Task GetWithBodyAsync()
+ {
+ using (var reader = new StreamReader(Request.Body, Encoding.UTF8, detectEncodingFromByteOrderMarks: false, bufferSize: 1024, leaveOpen: true))
+ {
+ var body = await reader.ReadToEndAsync();
+ // 现在你有了请求体,可以按照你的需求处理它
+ }
+
+ var reslut = BaseResultUtil.Success("操作成功");
+ return Ok(reslut);
+ }
+ }
+}
diff --git a/HttpClientStudy.WebApp/Program.cs b/HttpClientStudy.WebApp/Program.cs
index 4ca0d05..536753f 100644
--- a/HttpClientStudy.WebApp/Program.cs
+++ b/HttpClientStudy.WebApp/Program.cs
@@ -3,6 +3,7 @@ using System.Text;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Http.Features;
+using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
@@ -36,6 +37,14 @@ namespace HttpClientStudy.WebApp
option.IdleTimeout = TimeSpan.FromHours(1);
});
+ //Kestrelѡ
+ builder.Services.Configure( option =>
+ {
+ //ͬ IO (getbody)
+ //ASP.NET Core 3.0 ֮ǰİ汾AllowSynchronousIO Ĭǿ
+ option.AllowSynchronousIO = true;
+ });
+
//Formύѡ
builder.Services.Configure(options =>
{