MarimerLLC / cslaforum

Discussion forum for CSLA .NET
https://cslanet.com
Other
31 stars 6 forks source link

DataPortal WCF Clarification #108

Open MarkOverstreet opened 8 years ago

MarkOverstreet commented 8 years ago

In this old forum post

http://forums.lhotka.net/forums/p/12713/57635.aspx

I am getting the exact same message when trying to set up a client endpoint to use basicHttpBinding. In this post, Rocky recommended to read the book.

In your Using CSLA4: DataPortal eBook you state this on page 20...

"The contract value will always be Csla.Server.Hosts.IWcfPortal when you are using the standard CSLA .NET data portal WCF channel. "

However, if I do this I get the following error which clearly says it is looking for WcfPortal.IWcfPortal and not Csla.Server.Hosts.IWcfPortal. Why?

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.

Also, I simply want to use basicHTTP in my Winform app so what should my app.config look like? Here is my entire config entries...


app.config (winform client)

See attachment.

App.config.txt

web.config (server)

See attachment Web.config.txt

Any help would greatly be appreciated as I have already written this app and just need to get it deployed.

Thanks Mark

jonnybee commented 8 years ago

Your app.config cannot have both CslaDataPortalUrl and custom config.

When you have the CslaDataPortalUrl you will use the default config in CSLA. You must remove CslaDataPortalUrl from you config in order to use the config in system.serviceModel.

I would recommend to look at the samples for CSLA. There are several samples that use WcfPortal.

Your contract must be the same on the client and server side, ex in app.config:

<endpoint name="WcfDataPortal" address="http://localhost:21647/WcfPortal.svc" 
    binding="wsHttpBinding" contract="Csla.Server.Hosts.IWcfPortal"/>
MarkOverstreet commented 8 years ago

Hi Jonny,

Thanks for the comment. Yes, I realized the error and removed the CslaDataPortalUrl setting and then it behaved as expected but only once I changed the line from:

contract="Csla.Server.Hosts.IWcfPortal "

to this

contract="WcfPortal.IWcfPortal"

So my question is this: Was there a recent change in the framework that just hasn't been updated in the eBook because the book states this...

"The contract value will always be Csla.Server.Hosts.IWcfPortal when you are using the standard CSLA .NET data portal WCF channel. "

Final Working Endpoint in App.config: <endpoint name="WcfDataPortal" address="http://localhost:1934/Imaging/WcfPortal.svc" binding="basicHttpBinding" contract="WcfPortal.IWcfPortal"/>

rockfordlhotka commented 8 years ago

The change was in WCF itself, not in CSLA. About 3 years ago they apparently changed the way they read or resolve that value from the WCF configuration section in the config file.