WCF issues

WCF - Windows communication foundation - is the way we usually communicate between tiers with MDriven technology.

Turn on WCF-logging

WCF can be tricky since it is rather silent when it fails.

So if you have ruled out other issues and you still cannot get the communication to work turn on WCF-logging.

In most web.config we have left a commented block to turn on WCF-logging.

This is from the MDrivenServer:

2018-05-07 12h44 51.png

You can find more info here:

https://www.capableobjects.com/2011/06/26/wcf-and-eco/

https://www.capableobjects.com/2012/01/06/wcf-trouble-shoot/

WCF and ECO

If you build your own server (Remote persistence server for ECO), either as WindowsService or as a WinForm application (both available from the ECO VS Wizard) we use the WCF class ServiceHost.

In this ServiceHost we set some parameters – like what binding to use and so on. During the beta-phase of ECO6 it became apparent that we also needed to set a lot of other values like MaxReceivedMessageSize and MaxBufferPoolSize etc on the Binding object.

That code came to look like this:


     BasicHttpBinding binding = new BasicHttpBinding();
     
     binding.MaxReceivedMessageSize = maxReceivedMessageSize;
    
     binding.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;

     binding.MaxBufferSize = int.MaxValue;

     binding.MaxBufferPoolSize = 0; 

     Uri address = new Uri(uri);

     ServiceHost svc = new ServiceHost(t, address);

     svc.AddServiceEndpoint(typeof(IPersistenceMapperWCF), binding, address);  

The gotcha with this is that if you host your Remote persistence server in IIS – we do NOT use the ServiceHost because then IIS IS provides the ServiceHost for us.

So in this case we need to tune up the MaxReceivedMessageSize and MaxBufferPoolSize etc some other way : web.config.

So in your IIS hosted Remote Persistent Server you need to add something like this to your web.config:


<system.serviceModel>
  <services>
    <service name="Frako.Emvis.PServerWebService.EmvisPMPWCF" behaviorConfiguration="TheBehavior">
 
      <endpoint address=""
                binding="basicHttpBinding"
                bindingConfiguration="TheBindingConfiguration"
                contract="Eco.Wcf.Common.IPersistenceMapperWCF"  />  
 
    </service>
  </services>
  
  
  <bindings>      
    <basicHttpBinding>
      <binding name="TheBindingConfiguration"              
             maxReceivedMessageSize="104857600">
        <readerQuotas maxStringContentLength="104857600"/>
      </binding>
    </basicHttpBinding>
  </bindings>
  
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
      <behaviors>
          <serviceBehaviors>
              <behavior name="TheBehavior">
          
        <serviceDebug includeExceptionDetailInFaults="true" />
        <dataContractSerializer maxItemsInObjectGraph="2147483646" />
 
 
      </behavior>
          </serviceBehaviors>
      </behaviors>
  </system.serviceModel>

This page was edited 141 days ago on 12/20/2023. What links here