将自签名证书“ localhost”(DNS = localhost)更改为“ Cloudflare Origin Certificate”(dns = mydomain.com)后,出现以下错误:
SOAP security negotiation with 'http://localhost:8000/MyService.svc' for target 'http://localhost:8000/MyService.svc' failed. See inner exception for more details.
内部异常:
Either the client credential was invalid or there was an error collecting the client credentials by the SSPI.
我注意到的是,在启动客户端之后,我会看到输入凭据的窗口。邓诺为什么。
我的所作所为
WCF web.config
<system.serviceModel>
<client />
<behaviors>
<serviceBehaviors>
<behavior name="authBehavior">
<serviceAuthorization principalPermissionMode="UseWindowsGroups">
<authorizationPolicies>
<add policyType="WCF.Common.AuthorizationPolicy, WCF" />
</authorizationPolicies>
</serviceAuthorization>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WCF.Common.IdentityValidator, WCF" />
<serviceCertificate findValue="CloudFlare Origin Certificate" storeLocation="LocalMachine" x509FindType="FindBySubjectName" storeName="My" />
</serviceCredentials>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="svcBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpsBinding>
<binding name="basicHttpsEndpointBinding" maxReceivedMessageSize="1073741824" maxBufferSize="1073741824" maxBufferPoolSize="1073741824">
<readerQuotas maxDepth="32" maxArrayLength="1073741824" maxStringContentLength="1073741824" />
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpsBinding>
<wsHttpBinding>
<binding name="wsHttpEndpointBinding"></binding>
</wsHttpBinding>
</bindings>
<services>
<service name="WCF.MyService" behaviorConfiguration="svcBehavior">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpointBinding" contract="WCF.IMyService">
<identity>
<dns value="mydomain.com" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
客户端app.config
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="MessageAndUserName">
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
<binding name="WSHttpBinding_IMyService" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8777/MyService.svc"
binding="wsHttpBinding" contract="WCF.IMyService"
name="WSHttpBinding_IMyService">
<identity>
<dns value="mydomain.com" />
</identity>
</endpoint>
</client>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
我在WCF中托管其他服务,也在客户端中托管了一些服务,但不需要。
我在WCF和客户端之间使用wsHttpBindings。我该怎么办才能消除此错误?
使用wsHttpBinding等的目的是什么...:仅允许此客户端与MyService通信。不允许其他任何人。客户端应用将在域中的多台计算机上运行。您是否建议使用其他方法?
感谢任何想法!
编辑:错误计算机不在域中运行。都不适用于域:/
中的计算机EDIT2:安全模式传输 WCF web.config绑定:
<wsHttpBinding>
<binding name="wsHttpEndpointBinding">
<security mode="Transport">
<message clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
客户端配置绑定:
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IMyService">
<security mode="Transport">
<message clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://localhost:8001/MyService.svc"
binding="wsHttpBinding" contract="WCF.IMyService"
name="WSHttpBinding_IMyService">
<identity>
<dns value="mydomain.com" />
</identity>
</endpoint>
</client>
答案 0 :(得分:1)
这里有一些资源需要审查,以帮助确定NetTcpBinding是否适合您,这听起来像是因为您在内部使用Web服务。
NetTcpBinding 当WCF服务及其客户端位于Intranet基础结构中时,netTcpBinding最佳。由于它仅支持TCP协议而不支持HTTP,因此无法通过Internet访问服务。
此安全绑定用于在Intranet计算机中与二进制编码的SOAP消息一起发送。它支持可靠性,交易和安全性。如果您在IIS中使用netTcpBinding和主机WCF服务,则需要在系统上进行一些设置,而IIS this article将为您提供必需的设置。
一些疑难解答相关问题的提示:
有关NetTcpBinding的其他有用信息: