我正在尝试重写这行代码HttpContext.Current.Request.ServerVariables["HTTP_HOST"]
,它找不到当前的,它不包含定义。
.net核心中有一个扩展。要使用它,您需要安装如下所示的预请求包。
https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.httpcontextservervariableextensions.getservervariable?view=aspnetcore-5.0