Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NetCore3.1引入apollo后http请求永远返回http400的状态码 #163

Open
QQ897878763 opened this issue May 9, 2021 · 5 comments
Open

Comments

@QQ897878763
Copy link

这个问题真的太奇怪了,我使用nuget包或引入源码到项目都出现下面这个问题
image
image
在Startup类能够获取到apollo设置的配置项,长连接也一直是存在的。
就是出现这个400的状态码,在Program类中移除 builder.AddApollo就正常了。这是我的Program代码

public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
             Host.CreateDefaultBuilder(args)
             .ConfigureLogging(log =>
             {
                 log.ClearProviders();
                 log.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Information);
             })
             .UseServiceProviderFactory(new AutofacServiceProviderFactory())
                 .ConfigureWebHostDefaults(webBuilder =>
                 {
                     webBuilder.UseStartup<Startup>();
                 }).UseNLog()
            .ConfigureAppConfiguration((context, builder) =>
                 {
                     LogManager.UseConsoleLogging(Com.Ctrip.Framework.Apollo.Logging.LogLevel.Trace);                    
                     builder.AddEnvironmentVariables()
                           .AddCommandLine(args);
                     var config = builder.Build();
                     builder.AddApollo(config.GetSection("apollo"))
                             .AddDefault();                    
                 });
    }

下图是http的抓包数据
image

希望作者帮忙看下,确实自己实在是能力有限,没法解决问题,甚至原因都没找出来。

@QQ897878763
Copy link
Author

@nobodyiam

@QQ897878763
Copy link
Author

服务端部署的版本是1.8.1,查看了apollo-configservice的日志 并未发现异常

@pengweiqhca
Copy link
Contributor

你注释掉apollo应该也是这个错误吧

@QQ897878763
Copy link
Author

QQ897878763 commented May 10, 2021 via email

@ClementeGao
Copy link

@QQ897878763 你这个应该是在startup里注入了某个配置导致的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants