日期:2014-05-20  浏览次数:21174 次

求,俩天拉.WCF wfhttpBing,[从另一方收到未进行安全处理或安全处理不正确的错误。 有关错误代码和详细信息,请参见内部 FaultException。
关于WCF wsHttpBinding,
[从另一方收到未进行安全处理或安全处理不正确的错误。有关错误代码和详细信息,请参见内部 FaultException.]
报出了这个错误. 
相关设置如下:
config 配置如下:(XX.XX.X.11 为IP地址.为安全保密,X代替)
XX.XX.X.11 这个证书为不可信任机关发行的. 跟机器IP同名
把 XX.XX.X.11的服务器 换成 XX.XX.X.12 的服务器 ,证书换成 XX.XX.X.12 
同样是不可信任机关发行的.跟机器IP同名,却可以
求帮助,2天拉..老板发火拉.

Service config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service
name="WCF.MyService"
behaviorConfiguration="MyServicebehavior">
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="MyServiceBinding"
contract="WCF.IMyService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="MyServiceBinding">
<security mode="Message">
<message clientCredentialType="UserName"/>
</security>
</binding>
</wsHttpBinding>
</bindings>

<behaviors>
<serviceBehaviors>
<behavior name="MyServicebehavior">
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode="None" />
</clientCertificate>
<userNameAuthentication userNamePasswordValidationMode="Custom" 
customUserNamePasswordValidatorType="WCF.CustomUserNameValidator,WCF" />
<serviceCertificate findValue="XX.XX.X.11" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
</serviceCredentials>
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.web>
<trust level="Full" />
  <customErrors mode="Off"/>
</system.web>
</configuration>

client config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
  <bindings>
  <wsHttpBinding> 
  <binding name="WSHttpBinding_IMyService" closeTimeout="00:01:00"
  openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
  bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
  maxBufferPoolSize="524288" maxReceivedMessageSize="6553600"
  messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
  allowCookies="false">
  <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
  maxBytesPerRead="4096" maxNameTableCharCount="16384" />
  <reliableSession ordered="true" inactivityTimeout="00:10:00"
  enabled="false" />
  <security mode="Message">