Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 12th, 2013  |  syntax: None  |  size: 4.38 KB  |  hits: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. The message with Action 'http://MyWebService/IWebService/HelloWorld' cannot be
  2. processed at the receiver,
  3. due to a ContractFilter mismatch at the EndpointDispatcher.
  4. This may be because of either a contract mismatch (mismatched Actions between
  5. sender and receiver)
  6. or a binding/security mismatch between the sender and the receiver.  
  7. Check that sender and receiver have the same contract and the same binding
  8. (including security requirements, e.g. Message, Transport, None).
  9.        
  10. [ServiceContract(Namespace = "http://MyWebService", SessionMode = SessionMode.Required, CallbackContract = typeof(ISiteServiceExternal))]
  11. public interface IWebService {
  12.   [OperationContract]
  13.   void Register(long customerID);
  14. }
  15.  
  16. public interface ISiteServiceExternal {
  17.   [OperationContract]
  18.   string HelloWorld();
  19. }
  20.        
  21. [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
  22. class WebService : IWebService {
  23.   void IWebService.Register(long customerID) {
  24.     Console.WriteLine("customer {0} registering", customerID);
  25.     var callbackService = OperationContext.Current.GetCallbackChannel<ISiteServiceExternal>();
  26.     RegisterClient(customerID, callbackService);
  27.     Console.WriteLine("customer {0} registered", customerID);
  28.   }
  29. }
  30.        
  31. [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, Namespace="http://MyWebService")]
  32. class SiteServer : IWebServiceCallback {
  33.   string IWebServiceCallback.HelloWorld() {
  34. return "Hello World!";
  35.   }
  36.   ...
  37. }
  38.        
  39. <system.serviceModel>
  40.   <diagnostics>
  41.     <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true"
  42.         logMessagesAtTransportLevel="true" logEntireMessage="true" maxMessagesToLog="1000" maxSizeOfMessageToLog="524288" />
  43.   </diagnostics>
  44.   <behaviors>
  45.     <serviceBehaviors>
  46.       <behavior name="mex">
  47.         <serviceDebug includeExceptionDetailInFaults="true"/>
  48.         <serviceMetadata/>
  49.       </behavior>
  50.     </serviceBehaviors>
  51.   </behaviors>
  52.   <services>
  53.     <service name ="MyWebService.WebService" behaviorConfiguration="mex">
  54.       <endpoint address="net.tcp://localhost:8000" binding="netTcpBinding" contract="MyWebService.IWebService"
  55.                 bindingConfiguration="TestBinding" name="MyEndPoint"></endpoint>
  56.       <endpoint address ="mex"
  57.                 binding="mexTcpBinding"
  58.                 name="MEX"
  59.                 contract="IMetadataExchange"/>
  60.       <host>
  61.         <baseAddresses>
  62.           <add baseAddress="net.tcp://localhost:8000"/>
  63.         </baseAddresses>
  64.       </host>
  65.     </service>
  66.   </services>
  67.   <bindings>
  68.     <netTcpBinding>
  69.       <binding name="TestBinding" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" portSharingEnabled="false">
  70.         <readerQuotas maxDepth="32" maxStringContentLength ="8192" maxArrayLength ="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
  71.         <security mode="None"/>
  72.       </binding>
  73.     </netTcpBinding>
  74.   </bindings>
  75. </system.serviceModel>
  76.        
  77. <system.serviceModel>
  78.   <bindings>
  79.     <netTcpBinding>
  80.       <binding name="MyEndPoint" closeTimeout="00:01:00" openTimeout="00:01:00"
  81.           receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false"
  82.           transferMode="Buffered" transactionProtocol="OleTransactions"
  83.           hostNameComparisonMode="StrongWildcard" listenBacklog="10"
  84.           maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
  85.           maxReceivedMessageSize="65536">
  86.         <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
  87.             maxBytesPerRead="4096" maxNameTableCharCount="16384" />
  88.         <reliableSession ordered="true" inactivityTimeout="00:10:00"
  89.             enabled="false" />
  90.         <security mode="None">
  91.           <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign">
  92.             <extendedProtectionPolicy policyEnforcement="Never" />
  93.           </transport>
  94.           <message clientCredentialType="Windows" />
  95.         </security>
  96.       </binding>
  97.     </netTcpBinding>
  98.   </bindings>
  99.   <client>
  100.     <endpoint address="net.tcp://mydomain.gotdns.com:8000/" binding="netTcpBinding"
  101.         bindingConfiguration="MyEndPoint" contract="IWebService" name="MyEndPoint" />
  102.   </client>
  103. </system.serviceModel>
  104.        
  105. [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
  106. class WebService : IWebService { ... }
  107.        
  108. [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, Namespace="http://MyWebService")]
  109. class SiteServer : IWebServiceCallback { ... }