public void Configure(IApplicationBuilder app, IWebHostEnvironment env,
ILoggerFactory loggerFactory) { // allow body reusing app.Use(next => context => { context.
Request.EnableBuffering(); return next(context); }) } [HttpPost] public async
Task<string> Post() { //StreamReader sr = new StreamReader(Request.Body);
//string data = await sr.ReadToEndAsync(); string data = "";
//Request.EnableBuffering(); Multiple reads can be achieved Body Request.EnableBuffering(); StreamReader
sr= new StreamReader(Request.Body); data = await sr.ReadToEndAsync(); logger.
LogInformation("data=" + data); Request.Body.Seek(0, SeekOrigin.Begin); // Read again
You can still read it successfully Request.EnableBuffering(); StreamReader sr2 = new StreamReader(Request.
Body); string data2 = await sr2.ReadToEndAsync(); logger.LogInformation("data2="
+ data2); Request.Body.Seek(0, SeekOrigin.Begin); string header = $" Request header :\r\n";
foreach (var item in Request.Headers) { header += $"{item.Key}:{item.Value}\r\n"
; } logger.LogInformation(header); var ip = Request.Headers["X-Forwarded-For"].
FirstOrDefault(); if (string.IsNullOrEmpty(ip)) { //ip =
Request.HttpContext.Connection.RemoteIpAddress.ToString(); //ip =
Request.HttpContext.Connection.LocalIpAddress.MapToIPv4().ToString(); ip =
Request.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString(); } logger.
LogInformation("ip=" + ip); }

Technology
©2020 ioDraw All rights reserved
Vue slot slot: Default slot , Named slot , Scope slot algorithm : Longest common subsequence ( Output all longest common subsequences ) Simple student achievement management system 《 How does the program run 》 Chapter 11 Hardware control method FDTD solution—— Material fitting , Light source settings MMKV The principle and implementation of virtual reality ( one )vue-element-admin Step record of adding menu python Simple understanding of decorator Java The realization of snake eating (1 Hour Society ) New photo album app launched by Microsoft : Using cross platform framework React Native to write