Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hello Friends,
I am developing an application simillar to query designer.
I am facing following trouble
When I am execute query on server side it returns all rows if count of rows less than 21,000 but when row count greater than 21,000 it gives following exception exception

"The remote server returned an error: NotFound. "

Following is my code in WCF Service

C#
public List<Dictionary<string, object>> getDataWithPara(string procName, Dictionary<string, object> dictionary)
        {
            List<Dictionary<string, object>> list_ds = new List<Dictionary<string, object>>();
            try
            {
                SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["constr"].ToString());
                SqlCommand cmd = new SqlCommand(procName, conn);
                cmd.CommandType = CommandType.StoredProcedure;
                conn.Open();
                SqlCommandBuilder.DeriveParameters(cmd);
                foreach (SqlParameter p in cmd.Parameters)
                {
                    if (p.ParameterName.ToLower() != "@return_value")
                    {
                        var val = dictionary.Where(n => n.Key == p.ParameterName).Select(n => n.Value).ToList();
                        p.Value = val[0];
                    }
                }

                DataSet ds = new DataSet();
                SqlDataAdapter sql_da = new SqlDataAdapter(cmd);
                sql_da.Fill(ds);


                Dictionary<string, object> Dct = new Dictionary<string, object>();
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    Dct = new Dictionary<string, object>();
                    foreach (DataColumn dc in ds.Tables[0].Columns)
                    {
                        Dct.Add(dc.ColumnName, dr[dc.ColumnName].ToString());
                    }
                    list_ds.Add(Dct);
                }
                Thread.Sleep(1000);
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {

            }
            return list_ds;
        }

This is my App.config of wcf application
HTML
<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_svc_CRUD"
                 maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
                 receiveTimeout="00:40:00" openTimeout="00:40:00"
                 closeTimeout="00:40:00" sendTimeout="00:40:00">
          <readerQuotas maxDepth="2147483647"
              maxStringContentLength="2147483647" maxArrayLength="2147483647"
              maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
          <security mode="None"/>
        </binding>
      </basicHttpBinding>
    </bindings>
		<behaviors>
			<serviceBehaviors>
				<behavior>
					<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
					<serviceMetadata httpGetEnabled="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" ignoreExtensionDataObject="true"/>
					<!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
					<serviceDebug includeExceptionDetailInFaults="false" />
				</behavior>
			</serviceBehaviors>
		</behaviors>
		<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
		<services>
   <service name="wcfsvc_master.Session">
    <endpoint address="" binding="basicHttpBinding" contract="wcfsvc_master.ISession" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
   </service>
      
   <service name="wcfsvc_master.svc_CRUD">
     <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_svc_CRUD"
     contract="wcfsvc_master.Isvc_CRUD" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
     <timeouts closeTimeout="00:15:00" openTimeout="00:10:00" />
    </host>
   </service>
  </services>
    <client>
      <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_svc_CRUD"
     contract="wcfsvc_master.Isvc_CRUD" />
    </client>
	</system.serviceModel>

Please tell me what i am do
Posted
Updated 18-May-12 18:24pm
v4

The problem with this exception is that it tells you absolutely nothing about what really went wrong. We could guess, but that would be all we were doing, guessing. In order to find out what is really going wrong, I suggest that you follow the steps laid out here[^].
 
Share this answer
 
Comments
Wendelius 16-May-12 17:23pm    
IMO good advice.
From the information that you have provided, my best guess is that the problem is with your web.config. You need to increase the size of data that can be returned from server. And my assumption is that you are using WCF for that you need to set the following parameter in the binding configuration
maxReceivedMessageSize="2147483647"

I hope this helps
 
Share this answer
 
Comments
Sangramsingh Pawar 16-May-12 7:00am    
Still not working
I included myweb.config in my question plz see it

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