Click here to Skip to main content
16,019,740 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Freinds,

I am having an item Master with 200000 records. when I populate the combobox through WCF service, gets the follwoing error, however I have passed the maximum message size in the app.config.

The maximum message size quota for incoming messages (2147483647) has been exceeded.

could you please guide me how to fill a huge data through WCF service in client application .

here is the sample Code.

WCF service

public class ItemMaster
{
int ItemId;
string ItemName;
...
}



 List< itemmaster >  GetItemMaster()
{
....
}


Client application.

Combobox1.DataSource = cmbService.GetItemMaster();
combobox1.DisplayMember ="ItemName";
combobox1.ValueMember ="ItemId";



Thanks
Posted
Updated 28-Jun-10 20:26pm
v3

Read this[^] article. It should help.

You can also increase the message size in the binding configuration and it will work.

BTW, why are you binding Combobox with that huge set of values? A normal human being cannot process that many records in one go. I think you need a bit of re-designing of your application.
 
Share this answer
 
v2
//In wcf services
[OperationContract]
public List GetCountry()
{
List listcountry = new List();
using (SqlConnection con=new SqlConnection(connection))
{
using (SqlCommand cmd=new SqlCommand())
{
cmd.Connection = con;
cmd.CommandText = "select * from Country";
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Country country = new Country();
country.Id = Convert.ToInt32(reader["Id"].ToString());
country.CountryName = reader["CountryName"].ToString();
listcountry.Add(country);
}
}
}
return listcountry.ToList();
}


// In you xaml CS file


private void ComboBoxTest_Loaded(object sender, RoutedEventArgs e)
{
ServiceReference1.Service1Client connection1 = new ServiceReference1.Service1Client();
connection1.GetCountryCompleted += new EventHandler(GetCountry);
connection1.GetCountryAsync();
}

private void GetCountry(Object sender, ServiceReference1.GetCountryCompletedEventArgs e)
{
if (e.Error != null)
{
MessageBox.Show("Fail To Get Country" + e.Error.Message);
return;
}
else
{
ComboBoxTest.ItemsSource = e.Result.ToList();
ComboBoxTest.DisplayMemberPath = "CountryName";
ComboBoxTest.SelectedValuePath = "Id";
}
}
 
Share this answer
 

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



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