asp.net core 常见问题备注

1、asp.net core IIS部署运行环境修改目录下的web.config

<aspNetCore processPath="dotnet" arguments=".\WebApi.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess"> <environmentVariables> <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" /> </environmentVariables> </aspNetCore>
2、ASP.NET Core WebApi获取客户端IP
https://www.cnblogs.com/ypppt/p/13690518.html
public static string GetClientUserIp(this HttpContext context)
{
var ip = context.Request.Headers["X-Forwarded-For"].FirstOrDefault();
if (string.IsNullOrEmpty(ip))
{
ip = context.Connection.RemoteIpAddress.ToString();
}
return ip;
}

posted @ 2022-11-07 11:57  Thinking.N  阅读(33)  评论(0编辑  收藏  举报