提取行时出现问题 [英] Problem in fetching row

查看:89
本文介绍了提取行时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,
我正在开发一个类似查询查询设计器的应用程序.
我正面临以下麻烦
当我在服务器端执行查询时,如果行数少于21,000,它将返回所有行,但是当行数大于21,000时,它将给出以下异常异常

远程服务器返回了一个错误:NotFound."

以下是我在WCF服务中的代码

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

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;
        }


这是我的wcf应用程序的App.config


This is my App.config of wcf application

<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

推荐答案

此异常的问题是,它绝对不会告诉您真正出了什么问题.我们可以猜测,但这就是我们正在做的所有猜测.为了找出真正出了什么问题,我建议您按照
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[^].


来自根据您提供的信息,我最好的猜测是问题出在您的web.config.您需要增加可以从服务器返回的数据的大小.我的假设是您正在使用WCF,因此需要在绑定配置中设置以下参数
maxReceivedMessageSize ="2147483647"

希望对您有帮助
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


您好,
WCF服务-远程服务器返回了错误:未找到." [
Hi,
WCF Service - "The remote server returned an error: NotFound."[^]


这篇关于提取行时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆