Commit 67e8f4e3 authored by 黄奎's avatar 黄奎

页面修改

parent dd784a71
......@@ -138,34 +138,33 @@ namespace Mall.WebApi.Filter
/// <returns></returns>
private JObject DoApiMonitorLog(ActionExecutingContext actionContext, ref string token)
{
JObject parm = new JObject();
JObject parm = new JObject();
var request = actionContext.HttpContext.Request;
#region 如果参数是json实体对象,获取序列化后的数据
request.EnableBuffering();//重置读取
request.Body.Seek(0, SeekOrigin.Begin);
request.Body.Position = 0;
Stream stream = request.Body;
Encoding encoding = Encoding.UTF8;
if (request.ContentLength > 0)
request.EnableBuffering();
string responseData = "";
using (var reader = new StreamReader(request.Body, encoding: Encoding.UTF8))
{
var body = reader.ReadToEndAsync();
// Do some processing with body…
// Reset the request body stream position so the next middleware can read it
responseData = body.Result;
request.Body.Position = 0;
}
if (!string.IsNullOrWhiteSpace(responseData.Trim()))
{
byte[] buffer = new byte[request.ContentLength.Value];
stream.Read(buffer, 0, buffer.Length);
string responseData = Encoding.UTF8.GetString(buffer);
if (!string.IsNullOrWhiteSpace(responseData.Trim()))
try
{
try
{
parm = JObject.Parse(responseData);
actionContext.HttpContext.Items[GlobalKey.UserPostInfo] = responseData;
}
catch (Exception ex)
{
LogHelper.Write(ex, string.Format("DoApiMonitorLog:{0}", responseData));
}
token = JsonHelper.GetStringValue(parm, "token");
parm = JObject.Parse(responseData);
actionContext.HttpContext.Items[GlobalKey.UserPostInfo] = responseData;
}
catch (Exception ex)
{
LogHelper.Write(ex, string.Format("DoApiMonitorLog:{0}", responseData));
}
token = JsonHelper.GetStringValue(parm, "token");
}
#endregion
#endregion
return parm;
}
......
......@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
......@@ -20,6 +21,12 @@ namespace Mall.WebApi
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureKestrel((context, options) =>
{
options.AllowSynchronousIO = true;
//设置应用服务器Kestrel请求体最大为50MB
options.Limits.MaxRequestBodySize = 52428800;
});
webBuilder.UseStartup<Startup>().UseIIS();
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment