Hi,
I am porting our application from Remoting to WCF. Server side is working fine. But when I try to call a method in our object, I am still strugling. Could anyone help on this?
Here is my client side code.
ChannelFactory
<IWcfPortal> fact = new ChannelFactory<IWcfPortal>("Csla.Server.Hosts.WcfPortal"); IWcfPortal mgr = fact.CreateChannel(); WindowsPrincipal prn = new WindowsPrincipal(WindowsIdentity.GetCurrent()); Employees emp = new Employees(); FetchRequest fr = new FetchRequest( emp, new Csla.Server.DataPortalContext(prn, true)); WcfResponse res = mgr.Fetch(fr);// .StoreCustomer(cust);
....
I am getting below error.
System.ServiceModel.CommunicationException: The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
Thanks in advance.
-sa
WindowsPrincipal objects aren't serializable, so you can't pass them through the DataPortalContext object.
Are you building your own WCF channel? The code you list appears to be a mix of channel and business code? I have a working WcfChannel for the February CTP on my web site in the Downloads area. It should require no business code changes on your part at all - just a change to your client-side config file.
No. I am not building my own WCF channel. Here is my server side config as well as client side.
I am using your WcfChannel only. Still it is not working.
Server Side:
<
system.serviceModel><services>
<service name="Csla.Server.Hosts.WcfPortal">
<endpoint
address="http://localhost:8082/WcfManager" binding="basicHttpBinding" contract="Csla.Server.Hosts.IWcfPortal" /></
service></
services></
system.serviceModel>
Server Implementation:
class
Program{
private static ServiceHost _factoryHost; static void Main(string[] args){
StartWCFServer();
Console.ReadLine();}
private static void StartWCFServer(){
_factoryHost =
new ServiceHost(typeof(Csla.Server.Hosts.WcfPortal));_factoryHost.Open();
Console.WriteLine("WCF Server is running ...");}
Clinet Side:
<
system.serviceModel><
client><
endpoint name="Csla.Server.Hosts.WcfPortal" address="http://localhost:8082/WcfManager" binding="basicHttpBinding" contract="Csla.Server.Hosts.IWcfPortal" /></
client></
system.serviceModel>I didn't make any changes in existing working code. But still it is not working. Somewhere I am not doing right.
Dear Amal
Did you manage to get it to work eventually? Thanks.
Boon
Hmm. I fought with this sort of cryptic error for quite a while. It is so very clear that WCF is a beta product at this point...
Have you tried using either the Remoting or Enterprise Services channel to make sure your app works in general? That would help narrow the problem down to the WcfChannel rather than some other issue with serialization or your objects or whatever.
Yes. It works well with Remoting using RemotingProxy.rem.
Thanks
Amal
In that case I'm not sure what to suggest. My WcfChannel is a prototype written on top of a pre-beta, so it wouldn't surprise me if you've run into some glitch in either my code or in WCF (either is quite possible). On the other hand it could just be a configuration issue - it took me quite a few attempts to get even simple WCF communication working... People say Remoting is hard to configure, but WCF is several times harder than Remoting yet...
There are tools in the WCF SDK to log and monitor traffic over the wire. You may also want to add some log/trace output from the WcfChannel's server-side host class to see if the call even gets there, and if so whether the invocation of the business object succeeds.
Gotta love living beyond the bleeding edge...
Rocky
Copyright (c) Marimer LLC