【问题标题】:WCF Client Https: The underlying connection was closed: An unexpected error occurred on a sendWCF 客户端 Https:基础连接已关闭:发送时发生意外错误
【发布时间】:2014-07-07 21:26:45
【问题描述】:

我正在尝试使用协议 https 从我的客户端应用程序调用 wcf Web 服务。 Web 服务作为 Windows 服务运行。 客户端在调用 Web 服务方法时抛出以下异常。我也尝试使用默认端口 443。

内部异常:

底层连接已关闭:发生意外错误 发送。

异常消息:

发出 HTTP 请求时出错 https://myserver.com:1009/TestSvc ”。这可能是因为 服务器证书未正确配置中的 HTTP.SYS HTTPS 案例。这也可能是由于安全性不匹配造成的 客户端和服务器之间的绑定。

客户端绑定:

<system.serviceModel>
<bindings>
    <basicHttpBinding>
    <binding name="basicHttpBinding_ITest" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 
    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    <security mode="Transport"/>
    </binding>
    </basicHttpBinding>
</bindings>

<client>
    <endpoint address="<https://myserver.com:1009/TestSvc>" 
        binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_ITest" contract="ITest" name="basicHttpBinding_ITest">
    </endpoint>
</client>

<behaviors>
<endpointBehaviors>
    <behavior name="ClientCertificateBehavior">
    <clientCredentials>
        <clientCertificate findValue="a7aavvssrrffff400c527eadd528227323e788" storeLocation="Local Machine" storeName="My" x509FindType=" FindByThumbprint"/>
        <serviceCertificate>
            <authentication certificateValidationMode="PeerOrChainTrust" />
        </serviceCertificate>
    </clientCredentials>
    </behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>

谢谢

【问题讨论】:

  • 如果您使用 firefox 或 chrome 浏览服务,浏览器是否会抱怨证书?
  • @MikeHixson,如果从 MMC 打开证书,它不会显示任何错误。我会尝试使用firefox或chrome浏览服务,
  • 当我使用 Chrome 浏览时,它给出了 ssl 错误。我重新生成了证书并开始工作。请添加您的评论作为您的解决方案

标签: c# wcf visual-studio-2008 https basichttpbinding


【解决方案1】:

尝试使用 Web 浏览器查看证书是否有效。如果不是,那可能是问题所在。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-16
    • 1970-01-01
    相关资源
    最近更新 更多