Query regarding WCF endpoint contract in the client

Query regarding WCF endpoint contract in the client

Old forum URL: forums.lhotka.net/forums/t/12713.aspx

andrew123 posted on Wednesday, August 06, 2014

In a number of the examples in the CSLA e-books (i.e. UsingCsla4-04-DataPortal.pdf page 44) and in the sample WindowsUI client on github (https://github.com/MarimerLLC/csla/blob/master/Samples/NET/cs/SimpleNTier/WindowsUI/App.config) the client config is shown to be:

<endpoint .... contract="Csla.Server.Hosts.IWcfPortal"/>

However, if I put this into my client config, I get an InvalidOperationException:

Could not find endpoint element with name 'WcfDataPortal' and contract 'WcfPortal.IWcfPortal' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.

If I then change if to the following, it works (but I am skeptical I have everything set up correctly!)

<endpoint .... contract="WcfPortal.IWcfPortal"/>

Are the examples incorrect, or am I missing something regarding different ways to set the client up?

FYI, I have the proxy set to:

<add key="CslaDataPortalProxy" value="Csla.DataPortalClient.WcfProxy, Csla"/>


RockfordLhotka replied on Wednesday, August 06, 2014

Current versions of CSLA generally ignore the client-side system.ServiceModel configuration in the config file.

99.999% of the time people use the same configuration (or should), and were more often than not getting the configuration wrong. To avoid that recurring problem, the current WcfProxy sets up the WCF proxy in a known-to-be-correct manner.

As a result, you just need to add the CslaDataPortalUrl key in appSettings to point to your server URL and the data portal should do the rest.

If you need to customize the protocol/settings there are a number of options, which are described in the 'Using CSLA 4' book.

Copyright (c) Marimer LLC