自定义消息编码器WCF-无效签名

问题描述 投票:0回答:1

我尝试使用与@Misiu相同的服务,例如:Custom MessageEncoder add attributes to message without modifying structure

我知道该职位已有3年,但我希望有人知道答案。我正面临着同样的问题。

System.ServiceModel.CommunicationException:向https://dz3.swd.zbp.pl/broker3/services/QueryDz发出HTTP请求时发生错误。这可能是由于在HTTPS情况下未使用HTTP.SYS正确配置服务器证书。这也可能是由客户端和服务器之间的安全绑定不匹配引起的。 ---> System.Net.WebException:基础连接已关闭:发送时发生意外错误。 ---> System.IO.IOException:无法从传输连接中读取数据:现有连接被远程主机强行关闭。 ---> System.Net.Sockets.SocketException:现有连接被远程主机强制关闭

c# .net wcf soap wcf-security
1个回答
0
投票

我不知道问题的来龙去脉。上面的错误主要表示当我们使服务通过HTTPS工作时,服务证书没有正确配置,正如所提到的错误。为了使WCF服务可以在HTTPS上工作,我们应该添加具有传输安全模式的服务终结点。

    <services>
      <service name="WcfService3.Service1">
        <endpoint address="" binding="webHttpBinding" bindingConfiguration="mybinding" contract="WcfService3.IService1" behaviorConfiguration="mybeh"></endpoint>
      </service>
    </services>
    <bindings>
      <webHttpBinding>
        <binding name="mybinding">
          <security mode="Transport">
            <transport clientCredentialType="None"></transport>
          </security>
        </binding>
      </webHttpBinding>
</bindings>

随后,如果WCF项目托管在IIS中,则应添加https绑定,并在IIS站点绑定模块中绑定证书。enter image description here如果该服务是自托管的,则可以使用以下命令将证书绑定到特定端口。

netsh http add sslcert ipport=0.0.0.0:8000 certhash=0000000000003ed9cd0c315bbb6dc1c08da5e6 appid={00112233-4455-6677-8899-AABBCCDDEEFF}

请参阅以下文档。https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-configure-a-port-with-an-ssl-certificate请随时告诉我是否有什么我可以帮助的。

© www.soinside.com 2019 - 2024. All rights reserved.