Silverlight application - Setting up services

Silverlight application - Setting up services

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


Gort posted on Tuesday, December 07, 2010

I am trying to set up a new Silverlight application.  I continue to have issues getting the WcfPortal.svc set up correctly.  I am using CSLA 4.01 with .NET/SL 4.

I have my SL application and web hosting site.  In the site I have a WCF service called 'WcfSlPortal.svc' that looks like this:

<%

 

@ ServiceHost Service="Csla.Server.Hosts.Silverlight.WcfPortal" %>

If I have no reference to CSLA, I get the following error when I attempt to open the service page in a browser:

 

The type 'Csla.Server.Hosts.Silverlight.WcfPortal', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.

If I set a reference to CSLA (not Silverlight version), I can then view my service page properly. 

When I attempt to make the following call from my SL application, I run into issues:

BeginRefresh(evt =>

 

MyInfo.GetByIdAsync("123" , myEventHandler));

 

 In my event handler, I get the following error:

Could not load type 'Csla.Serialization.SerializableAttribute' from assembly 'Csla, Version=4.0.0.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30'.

So, I change the CSLA reference in my web site project to CSLA (for Silverlight), and then get the original errror when I attempt to view my service page in a browser once again:

The type 'Csla.Server.Hosts.Silverlight.WcfPortal', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.ANY help is greatly appreciated.

Also, do my class libraries which house my CSLA biz objects HAVE to be called <Project>.Client and <Project>.Server?  Mine are not and now I'm wondering if that may be my issues.

RockfordLhotka replied on Wednesday, December 08, 2010

You have to use the .NET version of Csla.dll on .NET (the server) and you have to use the SL version of Csla.dll on Silverlight (the client). The version of the dll must match the platform on which it is running.

The two versions of Csla.dll must be in sync (they must be the same version - even though they are built for each respective platform).

YOUR business assemblies must have the same assembly name, and use the same namespaces, even though they are built for each respective platform.

It doesn't matter what you name the project in Visual Studio, but the output dll names must be exactly the same, and so must their version numbers.

Serialization includes the assembly qualified type name of each type - which means the assembly qualified type name (assembly name, version, signing key) must be identical on client and server, even though the two assemblies are compiled for different platforms.

Gort replied on Wednesday, December 08, 2010

Rocky, thanks so much for the info.  The naming of the assemblies was my issue.  We just ordered the Silverlight videos so looking forward to reviewing those as well.

Tks.

Copyright (c) Marimer LLC