尝试调用自托管的wcf服务时出现此错误
例外:
System.Runtime.Remoting.ServerException未被用户代码
处理 Message =带有Action的消息 'http://schemas.microsoft.com/clr/nsassem/QuexstERP.BusinessCore.Interfaces.IOperationService/QuexstERP.BusinessCore.Interfaces#GetAll' 由于ContractFilter不匹配,无法在接收方处理 在EndpointDispatcher。这可能是因为合同 不匹配(发送者和接收者之间的不匹配行为)或a 发送方和接收方之间的绑定/安全性不匹配。校验 发件人和收件人具有相同的合同和相同的约束力 (包括安全要求,例如消息,传输,无) Source = mscorlib StackTrace: 服务器堆栈跟踪: 在[0]处重新抛出异常: 在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg) 在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,Int32类型)
服务配置
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service name="QuexstERP.BusinessCore.BusinessLogic.SysAdmin.OperationService" behaviorConfiguration="WCFBasicHttpBinding.Service1Behavior">
<endpoint address="" binding="basicHttpBinding" contract="QuexstERP.BusinessCore.Interfaces.IOperationService">
</endpoint>
<host>
<baseAddresses>
<add baseAddress="http://bu-06-04:9001/OperationService/" />
</baseAddresses>
</host>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="TCPBindingConfig" maxBufferSize="5242880" maxReceivedMessageSize="5242880">
<readerQuotas maxStringContentLength="5242880" />
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="WCFBasicHttpBinding.Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
客户端代码中的
IOperationService myObj = (IOperationService)Activator.GetObject(typeof(IOperationService),"http://bu-06-04:9001/OperationService/");
return myObj.GetAll();
GetAll方法导致异常