Csla Light remote server: NotFound problem

Csla Light remote server: NotFound problem

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


SteveC posted on Friday, October 16, 2009

I have been following the tutorial for Csla Light and building a proof of concept app as I go along. I am using Csla 3.7 and Silverlight 3. I am running everything locally on my laptop, using Cassini. My ASPNET web project contains both a clientaccesspolicy.xml and crossdomain.xml. My problem is that when I run the application I get the following error:

CommunicationException was unhandled by user code
The remote server returned an error: NotFound.

My solution is structured as follows:
In my silverlight application, my ServiceReferences.ClientConfig reads as follows:

<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IWcfPortal" maxBufferSize="65536"
                    maxReceivedMessageSize="65536" receiveTimeout="10" sendTimeout="10">
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:3405/WcfPortal.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWcfPortal"
                contract="Csla.WcfPortal.IWcfPortal" name="BasicHttpBinding_IWcfPortal" />
        </client>
    </system.serviceModel>
</configuration>

In my ASPNET web application, my WcfPortal.svc file is as follows:
<%@ ServiceHost Language="C#" Debug="true" Service="Csla.Server.Hosts.Silverlight.WcfPortal" CodeBehind="WcfPortal.svc.cs" %>

I have my ASPNET web application set to use port 3405. When I use Web Development Helper to track the calls I get the following:

http://localhost:3405/CslaSilverlightTestPage.aspx
http://localhost:3405/Silverlight.js
http://localhost:3405/ClientBin/CslaSilverlight.xap
http://localhost:3405/WcfPortal.svc

There is no detail for this last call, if I try to view the detail I get an error.

If I try to re-add the Service Reference to the Silverlight app using Visual Studio's service discovery tool, I get the following:
An error occurred while attempting to find services at 'http://localhost:3405/WcfPortal.svc'
Details:
The type 'Csla.Server.Hosts.Silverlight.WcfPortal', provided as the Service attribute value in the ServiceHost directive could not be found

I'm pretty much spinning my wheels now, having tried lots of things with no success, googled extensively and looked at all the sample apps. Any ideas??

SteveC replied on Friday, October 16, 2009

solved it!

This is wierd, so if anyone has any theories I would love to hear them.

The problem was with the the ASPNET web app which was hosting the SVC. When I looked in the bin directory, it had a copy to the CslaLight assembly instead of the CslaNET assembly. This is why I was getting an error about the type WcfPortal could not be found.

When I checked the project references, it correctly had a reference to CslaNet. I tried a couple of times removing the reference, cleaning the solution and then re-adding the reference, being super careful that I pointed to CslaNet and not CslaLight. Each time I did this, CslaLight appears in the bin folder.

Scratching my head, I removed the reference to CslaNet entirely. So now my ASPNET project only has a reference to my Csla.Server business object project and nothing else. Now when I build the solution, I end up with CslaNet in the bin folder and everything works just fine and dandy. Wtf?

Copyright (c) Marimer LLC