Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight with RIA WCF project can't add regular WCF service reference

I don't know if this is a bug/feature but I need to find a way to make it work.

To recreate, use VS2012, open a new SL5 project with RIA services enabled. Create another project, add a simple WCF service (or a SL enabled WCF) and add a method that accepts or returns a simple object (I have an object with one string property in it). Try and add this as a service reference to your SL project. You'll receive this error, among others, in the warnings:

Custom tool warning: No endpoints compatible with Silverlight 5 were found. The generated client class will not be usable unless endpoint information is provided via the constructor.

and no generated code is actually generated.

I found that if I remove the object from the service method and use a simple string/int/bool instead, the reference is added just fine. Also, if I add the same service to a regular SL app without RIA, everything works like you would expect it to. Once I enable RIA on this app where the service is working, and update the service reference, the generated code is gone again.

I remember this used to work because I had projects that used both RIA and external WCF services. Is this a new VS2012 thing? Is there a way to solve this issue?

Thanks,

Eyal

like image 214
Eyal Avatar asked Jan 19 '26 02:01

Eyal


1 Answers

I can duplicate the problem, and it only seems to happen if the Silverlight client has the 2 System.ServiceModel.DomainServices.Client and System.ServiceModel.DomainServices.Client.Web assemblies in its referenced assemblies. And only if it targets SL 5.

I have found 2 workarounds I recommend you try if your situation permits:

1) Change the Silverlight application to target Silverlight 4, not 5, or 2) Right-click the Service Reference and ask to Configure it. Click the checkbox to "Reuse types in specified referenced assemblies" and select all assembles except the 2 mentioned above.

This does appear to be a bug related to either SL 5 or VS2012. I will repost if I find a more satisfactory answer.

like image 155
Ron Cain Avatar answered Jan 21 '26 23:01

Ron Cain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!