Click here to Skip to main content
16,020,669 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi,

I am trying to create a new WCF project and then I want to add reference of it to a new Silverlight Project in VS 2010 (4.0). But when I call the WCF Service by adding the reference, it displayes "The given key was not present in the dictionary." error on running the project.

Code on Silverlight project to access the WCF service:
XML
WebNewsService.Service1Client objWebNewsService = new WebNewsService.Service1Client();
            objWebNewsService.GetLatestNewsCompleted += new EventHandler<WebNewsService.GetLatestNewsCompletedEventArgs>(objWebNewsService_GetLatestNewsCompleted);



I have tried to search on net for this but couldn't find any suitable answer.

I also have noticed that WCF project hasn't generated Disco file. But Interface is provided with all the methods in the WCF. All the methods return the correct values.

Can Anyone help me regarding this?

Also if anyone can give me accurate examples of usage of WCF in Silverlight project.

Thanks
Ashish
Posted
Comments
Christian Amado 3-Aug-12 10:17am    
Do you tested your WCF services first?
tusDev1 3-Aug-12 23:44pm    
Yes, As I had mentioned that all the methods are executing correctly and providing the correct output when I run the webservice project.

1 solution

First you must verify your WCF service in your respective project.

After that you Add the reference using bindings not as a Web service.

http://www.silverlight.net/learn/advanced-techniques/wcf-ria-services/get-started-with-wcf-ria-services[^] or http://social.msdn.microsoft.com/Search/en-US?query=wcf%20silverlight&ac=8[^]

Hope it helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900