Hello folks,

I was trying to integrate a asmx(asp.net 2.0) web service with my
silverlight 2 application.But i was getting an error and till now i
have not got any sollution.

So, i decided to move from simple asmx(asp.net 2.0) to WCF Service.

The steps i followed,

1. Created a Silverlight application with Visual Studio 2008
silverlight application template and by default it has created a test
web application for me.

So far so good.

2. In the second step i have added a new WCF service using FIle-->Add--
>New Web Site-->WCF service

3. I have added the WCF service reference to my silverlight project
using Add Service reference.

3. Now after adding all the required namespace i wrote the code in my
page.xmal.cs file like below,


        void Search_Click(object sender, RoutedEventArgs e)
        {
            ServiceReference1.Service1Client webService = new
ServiceReference1.Service1Client();
            webService.GetCustomersByNameCompleted += new
EventHandler<SilverlightApplication.ServiceReference1.GetCustomersByNameCompletedEventArgs>(GetCustomersByNameCompleted);
            webService.GetCustomersByNameAsync(txtName.Text);
        }

        void GetCustomersByNameCompleted(object sender,
SilverlightApplication.ServiceReference1.GetCustomersByNameCompletedEventArgs
e)
        {
            theDataGrid.ItemsSource = e.Result;
        }


Now ServiceReference1.Service1Client webService = new
ServiceReference1.Service1Client();
 line of code is throwing the exception,

The given key was not present in the dictionary

Reply via email to