fix: 修复前台系统无法获取客户端IP问题

This commit is contained in:
Argo Zhang 2019-09-02 11:21:01 +08:00
parent b45dd2e893
commit d3159aaa9d
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
1 changed files with 7 additions and 5 deletions

View File

@ -4,6 +4,7 @@ using Longbow.Web.SignalR;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@ -14,12 +15,12 @@ using System;
namespace Bootstrap.Client
{
/// <summary>
///
/// Startup 启动配置文件
/// </summary>
public class Startup
{
/// <summary>
///
/// 构造函数
/// </summary>
/// <param name="configuration"></param>
public Startup(IConfiguration configuration)
@ -28,13 +29,13 @@ namespace Bootstrap.Client
}
/// <summary>
///
/// 获得 系统配置项 Iconfiguration 实例
/// </summary>
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
/// <summary>
///
/// 服务容器注入方法
/// </summary>
/// <param name="services"></param>
public void ConfigureServices(IServiceCollection services)
@ -71,12 +72,13 @@ namespace Bootstrap.Client
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
/// <summary>
///
/// 管道构建方法
/// </summary>
/// <param name="app"></param>
/// <param name="env"></param>
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseForwardedHeaders(new ForwardedHeadersOptions() { ForwardedHeaders = ForwardedHeaders.All });
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();