views:

318

answers:

4

I've only been able to find a couple of people online mentioning this, and it seems to be as simple for them as adding the service reference.

However, when I attempt to add a service reference for my WCF service (which works correctly in a regular console app, so I have ruled the WCF out as the problem) I receive a host of errors.

  • Warning 5 Custom tool warning: No endpoints compatible with Silverlight 3 were found. The generated client class will not be usable unless endpoint information is provided via the constructor.
  • Warning 6 Custom tool warning: Exception has been thrown by the target of an invocation.
  • Warning 2 Custom tool warning: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
  • Error: Could not load type 'System.Runtime.Serialization.DataContractSet' from assembly 'System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
  • Warning 4 Custom tool warning: Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
  • Warning 3 Custom tool warning: Cannot import wsdl:binding Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
  • Error 7 Custom tool error: Failed to generate code for the service reference 'ServiceReference'. Please check other error and warning messages for details.

I find it strange that the first error mentions Silverlight 3, as I just completely uninstalled and reinstalled all of my development tools to ensure that I was using the latest version of .NET and Silverlight.

These errors look similar to the ones I see if I attempt to create a new Silverlight project and do not check the box "Enable WCF RIA services". I have not been able to find any means to enable that for WP7, if that is indeed the problem.

Any assistance from you scholarly gentlemen (and gentlewomen) would be much appreciated.

A: 

Hi,

Sorry no answer, but perhaps some small consolation in that I'm having the exact same issue. If I try to return a collection from my service - say List - I get the exact same error you're getting, but if I return a simple string it works fine.

Reading around tonight I'm no clearer, and all the examples of WP7 & WCF I've seen return simple types that work.

There's some talk of having to use the commandline tool to generate the proxy class:

"%windir%\Microsoft.NET\Framework\v3.\DataSvcUtil.exe" 
/language:CSharp /out:C:\temp\TestService.cs 
/uri:http://localhost:1234/TestService.svc

Good luck

J.

Jason Rousell
If you do resolve this issue, would you mind letting me know? I don't receive those errors when I use a silverlight service, but I also don't seem to be able to access the methods exposed by the service in a WP7 project the same way I can in any other type of project. Thanks!
Will
@Will Please see my answer if you are still running into this error.
Jace Rhea
+1  A: 

Hi,

Mmmm, I just changed the service reference config by ubnticking the "reuse type ...." box and then update worked and it generated the service config file. Not sure if this will help you?

J.

Jason Rousell
+1, I had this problem with the MS translation service and this seemed to fix it
Paul Betts
+1  A: 

Remember that Silverlight - even for Windows Phone, which uses a specialized version of Silverlight 3 - does NOT work with all WCF Service bindings/endpoints, but instead only supports a subset (which excludes WS-HTTP bindings, for example.) Your simplest bet is to create your WCF service for Silverlight applications using the "Silverlight-enabled WCF Service" template in Visual Studio (under Add/New Item/Silverlight).

This blog entry (http://blogs.msdn.com/b/silverlightws/archive/2009/03/20/what-s-new-with-web-services-in-silverlight-3-beta.aspx) from the Silverlight WCF Team Blog should shed some light on the possibilities. You may want to check out he whole blog (http://blogs.msdn.com/b/silverlightws/), as it has some interesting how-to and gotcha articles.

avidgator
+1  A: 

I ran into the exact same error, and changed the collection type to System.Collections.Generic.List instead of System.Collections.ObjectModel.ObservableCollections. This was odd since I did not even check the box for "Always generate message contracts".

Hope that helps.

Jace Rhea