Oops! That was a surprise when I added a WCF RIA services to my Silverlight application.
“This operation is not supported for a relative URI”
Well. Nothing to Panic. It’s a known issue in Visual Studio 2010, when you try to add a Service Reference in a Silverlight project. Simply Ignore it, your service will be added successfully.
I guess, this month is really buggy for me. Encountered a lot of errors and bugs during the development and my recent posts reflects the same. Because, I’m pushed through a lot of new Technologies during these days. It’s not that lot of new technologies are released during these days. But, the fact is - I’m a late adopter of Technology.
This time, I’s integrating a Silverlight Application into an existing 3-tier architecture project. Since, the idea of layer reuse exists, I used the same layers for building the Silverlight Application. The business later for my project is a Windows DLL and I referred the DLL into my Silverlight application for making reusing of layer practical.
Bhoom!!! I’s shocked with an error:
You can only add project references to other Silverlight project in the solution.
Upon close investigation, its clear that the CLR for both desktop and Silverlight uses 2 different engine. And that is the reason, why I cannot refer my Windows DLL into the Silverlight application.
Here you have 2 options:
- Use a Silverlight Class Library
- Use WCF Service.
I’ll ask you to go with WCF.
And please note. not every Windows namespaces are available in Silverlight, say you won’t get System.Data namespace and few others. This is done to keep the Silverlight plugin as simple and light-weight as possible. Might there be any future enhancements. But as of now, not everything that is available in Windows DLL is not available in Silverlight. So before you jump on to Silverlight and start developing the Rich application, please please please take care of the available data retrieval options.
Hope this helps.
Thanks and Merry X’Mas.
That was a surprise, when I run my first WCF application in .NET 4.0. I’s blown with an error:
Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=188.8.131.52, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Have you noticed the error message where the System.ServiceModel has version 3.0. Yup, That’s it!
This error can occur in 2 scenarios:
- IIS is installed after installing .NET Framework 4.0
- Version 3.0 of WCF Http Activation Module is installed after installing IIS and .NET Framework 4.0
However, this can be easily solved by registering the correct version of ASP.NET. So, fire up your Visual Studio 2010 Command Prompt or browse to "C:\Windows\Microsoft.NET\Framework\ v4.0.30319". And run the following command from the command prompt: