gpt4 book ai didi

c# - BTS 2013 - 消息的消息签名错误

转载 作者:太空宇宙 更新时间:2023-11-03 13:22:05 26 4
gpt4 key购买 nike

我遇到 BizTalk Server 2013 和 WCF 服务的问题。 BizTalk 需要使用 WCF 服务。 BizTalk 需要使用 X509 证书对消息进行签名,我收到以下错误消息:

There was a failure executing the send pipeline: "BizTalkUtilities.SignPipeline, 
BizTalkUtilities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d749e81ab815db56" Source:
"MIME/SMIME encoder" Send Port: "SndPort_Sign_V2" URI: "http://XXXX/DemoServiceSigned
/DemoService.svc" Reason: The message has a bad message signature.

首先,我创建了没有安全性的服务,一切正常。一旦我设置了我的安全性(消息安全性、签名),它就不再起作用了。为了确保我的服务没有问题,我创建了一个测试 WCF 客户端,它使用具有安全性的服务 - 没问题。

消息需要使用 X509 证书进行签名。所有证书都在正确的位置。我遵循了 MSDN 上所述的信息.

服务配置:

<bindings>
<wsHttpBinding>
<binding name="clientSignConfig">
<security mode="Message">
<message clientCredentialType="Certificate"/>
</security>
</binding>
</wsHttpBinding>
</bindings>

<services>
<service name="SignServiceBL.DemoService" behaviorConfiguration="DemoServiceBehavior">
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="clientSignConfig"
contract="SignServiceBL.IDemoService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>

<behaviors>
<serviceBehaviors>
<behavior name="DemoServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode="PeerTrust" trustedStoreLocation="LocalMachine"/>
</clientCertificate>
<serviceCertificate findValue="CN=DemoServiceServerCertificate"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>

客户端配置(这适用于 WCF 客户端,但不适用于 BizTalk)

<bindings>
<customBinding>
<binding name="demoService_CustomBinding">
<transactionFlow />
<security authenticationMode="SecureConversation" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
<secureConversationBootstrap authenticationMode="MutualSslNegotiated" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" />
</security>
<textMessageEncoding />
<httpTransport />
</binding>
</customBinding>

</bindings>

<behaviors>
<endpointBehaviors>
<behavior name="signingBehavior">
<clientCredentials>
<clientCertificate findValue="CN=DemoServiceSigning"
storeLocation="CurrentUser" storeName="My"/>
<serviceCertificate>
<authentication certificateValidationMode="PeerTrust" trustedStoreLocation="LocalMachine"/>
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>

<client>
<endpoint address="http://XXXX/DemoServiceSigned/DemoService.svc"
binding="customBinding" bindingConfiguration="demoService_CustomBinding" behaviorConfiguration="signingBehavior"
contract="DemoService.IDemoService" name="WSHttpBinding_IDemoService">
<identity>
<dns value="DemoServiceServerCertificate"/>
</identity>
</endpoint>
</client>

我已经设置了跟踪,但 BizTalk 甚至没有向我的服务发送消息。就像发送管道阻止了我的请求。

有什么想法吗?

编辑

您不需要带有 MIME/SMIME 编码器的管道来签署 WCF 消息。如果您需要签署电子邮件,您应该使用此管道...请参阅 MSDN 的第一句

BizTalk Server supports signing outbound messages and signature verification for inbound Secure Multipurpose Internet Mail Extensions (S/MIME) messages

删除管道后,BizTalk 会向服务发送一条消息。现在的问题是它已经签名并加密了。我正在弄清楚如何告诉 BizTalk 只签署消息。如果您有任何想法,请随时发布。如果我找到它,我会发布它;-)

最佳答案

这并不容易,但我能够解决我的问题:-)

我写了一个blogpost关于它,因为在这里创建答案有点复杂。所以检查一下!

关于c# - BTS 2013 - 消息的消息签名错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23784020/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com