【发布时间】:2011-09-29 22:08:08
【问题描述】:
我正在尝试配置我的 WCF (.NET 4.0) 服务,以便可以使用soapUI 对其进行测试。我正在使用具有消息安全性的 wsHttpBinding。我的目标是在公共测试端点上公开服务并尝试使用使用soapUI 测试的loadUI 对其进行负载测试。为此,端点需要是安全的,并且由于我的生产端点将使用消息安全性,我认为我的测试也应该使用它以实现接近生产负载测试结果。
我似乎无法配置soapUI 以成功调用服务。我尝试了多种使用客户端和服务器证书对输入和输出进行签名和加密的组合。有没有人成功实现了 WCF 和soapUI 的消息安全配置?
以下是我的配置摘录:
绑定:
<wsHttpBinding>
<binding name="MessageSecurity">
<security mode="Message">
<message clientCredentialType="Certificate" negotiateServiceCredential="false"/>
</security>
</binding>
</wsHttpBinding>
行为
<behaviors>
<serviceBehaviors>
<behavior name="customBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True"/>
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode="PeerTrust"/>
</clientCertificate>
<serviceCertificate findValue="MyWebServicesCertificate" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttp">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
服务:
<service behaviorConfiguration="customBehavior" name="MyService">
<!-- Service Endpoint -->
<endpoint name="Production" address="" binding="wsHttpBinding" bindingConfiguration="MessageSecurity" contract="IMyService">
<identity>
<dns value="web_services_svr"/>
</identity>
</endpoint>
<host>
<baseAddresses>
<add baseAddress="http://web_services_svr/MyService.svc" />
</baseAddresses>
</host>
</service>
【问题讨论】:
-
您从 SOAPUI 尝试连接时得到的具体错误是什么?
-
尝试从控制台应用程序调用服务。使用 fiddler 捕获请求和响应并进行验证。
标签: wcf wcf-security soapui