I found a few bits and pieces on the web and some samples, none of which worked when opened in Visual Studio - all those version differences and breaking changes take their toll on such samples.
One such example was provided by Shane Kercheval at http://www.shanekercheval.com/?p=66.
Like the others however, this would not build for me and I spent some time getting things up to date for the latest version of RIA and working through those breaking changes; changes such as removing the HttpHandlers and replacing with HttpModules for the RIA Domain Services, using WebContext instead of RiaContext (one that caused me much wasted time when first looking at RIA samples and wondering why they would not work for me).
A great help on this front was found here http://www.whycantyoucode.com/2009/11/verbose-steps-to-migrate-a-silverlight-application-from-net-ria-services-july-09-to-wcf-ria-services-pdc-09/
I also had to update a hardcoded database path (in NHibernateSessionFactory.cs, you will too if you want to run the code - unless by some fluke you have matching paths). It is a sample after all so I can accept that (my plan is to use SQL Server for the PoC work).
Once I had eventually got things building the app would not run for me (note: I did not attempt to sort the Region / Country issue mentioned in the comments of Shane's post - I commented the validation code out as that was not pressing for me just now).
Another waste of time? Not this time - I was determined to get this one up and running as my primary goal for the evening was to have a working sample of SL3, RIA Services and Fluent NHibernate. The code was building, just not running.
The services were returning 'Not Found' errors on the GetRegions and GetContacts methods. Of course, right now RIA returns this error for any server side error, so I used Fiddler and found it was actually a 500 error coming back.
Checking the event log I found an error that gave me my exception:
at System.Web.Ria.Services.DomainServiceVirtualPathProvider.OwnsFile(String virtualPath)
at System.Web.Ria.Services.DomainServiceVirtualPathProvider.FileExists(String virtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
at System.Web.Ria.Services.DomainServiceVirtualPathProvider.OwnsFile(String virtualPath)
at System.Web.Ria.Services.DomainServiceVirtualPathProvider.FileExists(String virtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
This suggested that the virtual path provider was not finding my service, so next I tried something I should have done some time ago, I attempted to hit the services in a browser. The service did not display as expected - you know the usualy screen you see for a WCF service.
A little more digging around and I decided to add .svc files for each service (and an associated Host Factory) so that I could prove to myself that the services were there are working.
These are quite simple a to add, just add a text file named
<%@ ServiceHost
Service="BusinessApp.Web.BussinessAppDomainService"
Factory="System.Web.Ria.BusinessAppDomainServiceHostFactoryEx"
%>
It worked! Now I finally have a sample working on my machine (I think I made it sound easier than it was here, but was too early in the morning to put all the woes down here).
Thanks to Shane and of course Brad A for thier part in putting things together.
Download the updated source here.
(Of course - you might not get it to build 1st time but most of the work has been done for you and it's always a good learning experience to hit and resolve problems!! One thing that is very possible is that you will need to remove and re-add some references - I think this can be due to having 32bit vs 64bit OS on machines)