Database unable to return data to all clients for 10 clients or more making same call at same time.
-
I have been working on this one for week and I need help. It is complicated but I will try to explain what is going on and show a little code. What I have is a Silverlight application that communicates via WCF to the database. Now, the complicated part is that a windows job sends a UDP alert packet to each of the Silverlight clients to trigger an update of a DataGrid on the main page which does it update via the same WCF service Async call. This means that if I have 50 Silverlight clients when the alert packet is fired each of the 50 clients will make the same WCF call to the database. I have checked and insured that each client receives the UDP call. The problem is that when the clients all make the same call It gives me a wcf service error on some, but not all, of the clients. The code below shows the basic concept of the code in WCF service database call and Silverlight code. Of course the code is broken up into several sections, but you should get the main idea. (WCF CODE) List clist = new List(); ... _sqlcommand = new SQLCommand(); _sqlcommand = new SQLCommand(); _sqlcommand.Connection = _database.connectionString; _sqlcommand.CommandType = CommandType.StoredProcedure; _sqlcommand.CommandText=”GetCustomers”; try { Customer customer; _reader = _sqlcommand.ExecuteReader(); While (_reader.Read()) { customer = new Customer(); customer.Name = _reader[“Name”].ToString(); … … … clist.Add(customer); } } catch (exception e) { … } } return clist; (SILVERLIGHT CODE) observableCollection obsCollection = new observableCollection(); private getmethod() { current.client.GetCustomerServiceCompleted += new EventHandler(ServiceReference.GetCustomerServiceCompleteEventArgs(client_GetCustomerServiceCompleted); current.client.GetCustomerServiceAsync(); } void client_GetCustomerServiceCompleted (sender, ServiceReference. GetCustomerServiceCompleteEventArgs e) { obsCollection = e.Results; this.CustomerGrid.ItemsSource = obsCollection; } Thank you very much! Steve Holdorf
-
I have been working on this one for week and I need help. It is complicated but I will try to explain what is going on and show a little code. What I have is a Silverlight application that communicates via WCF to the database. Now, the complicated part is that a windows job sends a UDP alert packet to each of the Silverlight clients to trigger an update of a DataGrid on the main page which does it update via the same WCF service Async call. This means that if I have 50 Silverlight clients when the alert packet is fired each of the 50 clients will make the same WCF call to the database. I have checked and insured that each client receives the UDP call. The problem is that when the clients all make the same call It gives me a wcf service error on some, but not all, of the clients. The code below shows the basic concept of the code in WCF service database call and Silverlight code. Of course the code is broken up into several sections, but you should get the main idea. (WCF CODE) List clist = new List(); ... _sqlcommand = new SQLCommand(); _sqlcommand = new SQLCommand(); _sqlcommand.Connection = _database.connectionString; _sqlcommand.CommandType = CommandType.StoredProcedure; _sqlcommand.CommandText=”GetCustomers”; try { Customer customer; _reader = _sqlcommand.ExecuteReader(); While (_reader.Read()) { customer = new Customer(); customer.Name = _reader[“Name”].ToString(); … … … clist.Add(customer); } } catch (exception e) { … } } return clist; (SILVERLIGHT CODE) observableCollection obsCollection = new observableCollection(); private getmethod() { current.client.GetCustomerServiceCompleted += new EventHandler(ServiceReference.GetCustomerServiceCompleteEventArgs(client_GetCustomerServiceCompleted); current.client.GetCustomerServiceAsync(); } void client_GetCustomerServiceCompleted (sender, ServiceReference. GetCustomerServiceCompleteEventArgs e) { obsCollection = e.Results; this.CustomerGrid.ItemsSource = obsCollection; } Thank you very much! Steve Holdorf
-
Just a suggestion. If you're using Windows XP and Http Binding, XP has a limitation of 10 concurrent Http connections.
Thanks for the quick response; however, we are using Windows 7 all the way around. Still not sure. My DBA used the NO LOCK for the stored procedure but still no luck. Thanks, Steve Holdorf
-
Thanks for the quick response; however, we are using Windows 7 all the way around. Still not sure. My DBA used the NO LOCK for the stored procedure but still no luck. Thanks, Steve Holdorf
To solve the problem all I did was put a using(connection = new SQLConnection ...) statment around the code using the sql connection so the unmanaged resources were garbage collected. Thanks, Steve Holdorf