• [.net core] 在 Windows 中运行出现 WinHttpException: The parameter is incorrect


    有一个 web 服务一直跑在 docker 中,今天需要在 Windows 上部署一个备份版本,于是,签出源代码,编译,运行。结果抛出 500 ,日志中有如下记录:

    System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.Http.WinHttpException: The parameter is incorrect
       at System.Net.Http.WinHttpException.ThrowExceptionUsingLastError()
       at System.Net.Http.WinHttpHandler.InternalSendRequestAsync(WinHttpRequestState state)
       at System.Net.Http.WinHttpHandler.<StartRequest>d__105.MoveNext()
       --- End of inner exception stack trace ---

    异常发生在调用一个其他服务时发生的,根据异常消息:“The parameter is incorrect” 百思不解,刚开始以为是依赖的服务没有部署好,重新部署之后,问题依旧。

    外事不决,问 Google:“WinHttpException: The parameter is incorrect”

    原来是 WinHttpHandler 无法处理带有 body 的 GET 请求,链接地址:https://github.com/dotnet/corefx/pull/28367

    这个 PR 并没有解决这个问题,只是抛出了一个更友好的异常信息。不过没关系,知道了问题的原因,那么解决办法就很简单了:

    不在 GET 请求中添加 Body 即可。

  • 相关阅读:
    Nginx 配置文件
    Nginx 目录结构
    Nginx 功能模块
    logrotate日志管理工具
    Nginx 编译安装
    CentOS7安装Tomcat
    springcloud如何实现服务的平滑发布
    springcloud zuul聚合微服务的swagger文档
    alibaba的springcloud孵化器项目
    springcloud灰度发布实现方案
  • 原文地址:https://www.cnblogs.com/kexxxfeng/p/8780060.html
Copyright © 2020-2023  润新知