Problem with Silverlight application using WCF Service to get the data from database without LINQ
-
Hi I'm using a wcf service to get the data from the database and bind it silverlight control. And below is the code sample that i've written. Problem here is WCF service that i've created is on basichttpbinding. Silverlight supports only this binding I think. So I changed the end point in my WCF service from default (wsHTTPbining ) to basic. when i add the service reference to the silverlight application the following is the silverlight clientconfig I'm getting with the error that i got when i build the application. <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_ITestWCF" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <security mode="None" /> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:8731/TestWCFLib/basic" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestWCF" contract="testService.ITestWCF" name="BasicHttpBinding_ITestWCF" /> </client> </system.serviceModel> </configuration> Unhandled Error in Silverlight 2 Application An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at MNetMetricSystem.testService.GetBugCountCompletedEventArgs.get_Result() at MNetMetricSystem.OrganizationBaseLine.obj_GetBugCountCompleted(Object sender, GetBugCountCompletedEventArgs e) at MNetMetricSystem.testService.TestWCFClient.OnGetBugCountCompleted(Object state) public partial class OrganizationBaseLine : UserControl 2 { 3 ServiceReference1.MNetMetricsServiceClient Metrics = new MNetMetricSystem.ServiceReference1.MNetMetricsServiceClient(); 4 public OrganizationBaseLine() 5 { 6 InitializeComponent(); 7 Loaded += new RoutedEventHandler(OrganizationBaseLine_Loaded); 8 } 9 10 void OrganizationBaseLine_Loaded(object sender, RoutedEventArgs e) 11 { 12 13 Metrics.GetAllDepartmentsCompleted += new EventHandler(Metrics_GetAllDepartmentsCompleted); 14 Metrics.GetAllDepartmen
-
Hi I'm using a wcf service to get the data from the database and bind it silverlight control. And below is the code sample that i've written. Problem here is WCF service that i've created is on basichttpbinding. Silverlight supports only this binding I think. So I changed the end point in my WCF service from default (wsHTTPbining ) to basic. when i add the service reference to the silverlight application the following is the silverlight clientconfig I'm getting with the error that i got when i build the application. <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_ITestWCF" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <security mode="None" /> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:8731/TestWCFLib/basic" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestWCF" contract="testService.ITestWCF" name="BasicHttpBinding_ITestWCF" /> </client> </system.serviceModel> </configuration> Unhandled Error in Silverlight 2 Application An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at MNetMetricSystem.testService.GetBugCountCompletedEventArgs.get_Result() at MNetMetricSystem.OrganizationBaseLine.obj_GetBugCountCompleted(Object sender, GetBugCountCompletedEventArgs e) at MNetMetricSystem.testService.TestWCFClient.OnGetBugCountCompleted(Object state) public partial class OrganizationBaseLine : UserControl 2 { 3 ServiceReference1.MNetMetricsServiceClient Metrics = new MNetMetricSystem.ServiceReference1.MNetMetricsServiceClient(); 4 public OrganizationBaseLine() 5 { 6 InitializeComponent(); 7 Loaded += new RoutedEventHandler(OrganizationBaseLine_Loaded); 8 } 9 10 void OrganizationBaseLine_Loaded(object sender, RoutedEventArgs e) 11 { 12 13 Metrics.GetAllDepartmentsCompleted += new EventHandler(Metrics_GetAllDepartmentsCompleted); 14 Metrics.GetAllDepartmen
I'm missing something here....where is the problem? Is this a WCF problem or a database access problem? You showed WCF configuration....is that from the client side or the server side? What does the other end's configuration look like?
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I'm missing something here....where is the problem? Is this a WCF problem or a database access problem? You showed WCF configuration....is that from the client side or the server side? What does the other end's configuration look like?
Mark Salsbery Microsoft MVP - Visual C++ :java:
Thanks Mark for the reply. Problem is while adding service reference to the silverlight application in ServiceReference.ClientConfig file it shows the end points properly. That means no problem with WCF Service. In the WCFTESTCLIENT also I tested, It works very well. But when I bind the service method in the pageloading event to a silverlight combobox control, It is showing the following error..... Unhandled Error in Silverlight 2 Application An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at MNetMetricSystem.Metrics.GetAllDepartmentsCompletedEventArgs.get_Result() at MNetMetricSystem.OrganizationBaseLine.Met_GetAllDepartmentsCompleted(Object sender, GetAllDepartmentsCompletedEventArgs e) at MNetMetricSystem.Metrics.MNetMetricsServiceClient.OnGetAllDepartmentsCompleted(Object state)
-
Thanks Mark for the reply. Problem is while adding service reference to the silverlight application in ServiceReference.ClientConfig file it shows the end points properly. That means no problem with WCF Service. In the WCFTESTCLIENT also I tested, It works very well. But when I bind the service method in the pageloading event to a silverlight combobox control, It is showing the following error..... Unhandled Error in Silverlight 2 Application An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at MNetMetricSystem.Metrics.GetAllDepartmentsCompletedEventArgs.get_Result() at MNetMetricSystem.OrganizationBaseLine.Met_GetAllDepartmentsCompleted(Object sender, GetAllDepartmentsCompletedEventArgs e) at MNetMetricSystem.Metrics.MNetMetricsServiceClient.OnGetAllDepartmentsCompleted(Object state)
I can only guess with the given information. Looks like you need to debug your server so you can get more meaningful exception info. WHERE the exception is occurring would be helpful too. The exception message you posted mentions checking the inner exception... what's there?
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Hi I'm using a wcf service to get the data from the database and bind it silverlight control. And below is the code sample that i've written. Problem here is WCF service that i've created is on basichttpbinding. Silverlight supports only this binding I think. So I changed the end point in my WCF service from default (wsHTTPbining ) to basic. when i add the service reference to the silverlight application the following is the silverlight clientconfig I'm getting with the error that i got when i build the application. <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_ITestWCF" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <security mode="None" /> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:8731/TestWCFLib/basic" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestWCF" contract="testService.ITestWCF" name="BasicHttpBinding_ITestWCF" /> </client> </system.serviceModel> </configuration> Unhandled Error in Silverlight 2 Application An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at MNetMetricSystem.testService.GetBugCountCompletedEventArgs.get_Result() at MNetMetricSystem.OrganizationBaseLine.obj_GetBugCountCompleted(Object sender, GetBugCountCompletedEventArgs e) at MNetMetricSystem.testService.TestWCFClient.OnGetBugCountCompleted(Object state) public partial class OrganizationBaseLine : UserControl 2 { 3 ServiceReference1.MNetMetricsServiceClient Metrics = new MNetMetricSystem.ServiceReference1.MNetMetricsServiceClient(); 4 public OrganizationBaseLine() 5 { 6 InitializeComponent(); 7 Loaded += new RoutedEventHandler(OrganizationBaseLine_Loaded); 8 } 9 10 void OrganizationBaseLine_Loaded(object sender, RoutedEventArgs e) 11 { 12 13 Metrics.GetAllDepartmentsCompleted += new EventHandler(Metrics_GetAllDepartmentsCompleted); 14 Metrics.GetAllDepartmen
-
Are you using DataTable? (From the looks of it your WCF returns DataTable) Silverlight does not support DataSet and DataTable, therefore your WCF has to return the result as an ICollection, e.g. List, ArrayList. Edbert Sydney, Australia
Thanks for the reply Ebert, I returned list only from the wcf service. Is there any alternative way to get data from the database without WCF service? Ravi Vellanki, AP,India.