WindowsMobile中使用WCF,当WCF中返回1个400行的DataTable时,返回为空,当小于400行时可以返回?
是WCF配置文件的问题吗?配置文件如下<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <compilation debug="false" />    <!--将上传文档的大小控制在20M以内-->
    <httpRuntime executionTimeout="3000" maxRequestLength="204800" useFullyQualifiedRedirectUrl="false" />
  </system.web>  <!-- 部署服务库项目时,必须将配置文件的内容添加到 
  主机的 app.config 文件中。System.Configuration 不支持库的配置文件。-->
  <system.serviceModel>
    <services>
      <service name="WcfServiceLibrary1.Service1" behaviorConfiguration="WcfServiceLibrary1.Service1Behavior">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/WcfServiceLibrary1/Service1/"   />
          </baseAddresses>
        </host>
              
        <endpoint address="basic"  binding="basicHttpBinding" bindingConfiguration="mybasicHttpBinding" contract="WcfServiceLibrary1.IService1">
        
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
       
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfServiceLibrary1.Service1Behavior">
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>    <bindings>
      <basicHttpBinding>
        <binding name="mybasicHttpBinding" sendTimeout="00:10:00" maxBufferSize="655360000"
          maxBufferPoolSize="655360000" maxReceivedMessageSize="655360000"
          messageEncoding="Text">
          <readerQuotas maxDepth="320" maxStringContentLength="655360000"
            maxArrayLength="655360000" maxBytesPerRead="65536" maxNameTableCharCount="655360000" />
        </binding>
      </basicHttpBinding>
    </bindings>
    
  </system.serviceModel>
</configuration>

解决方案 »

  1.   

    加个这个试试
        <behaviors>
          <endpointBehaviors>
            <behavior name="ServiceViewEventBehavior">
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
            </behavior>
          </endpointBehaviors>
        </behaviors>
      

  2.   

    谢谢,加上了也不行!<?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.web>
        <compilation debug="false" />    <!--将上传文档的大小控制在20M以内-->
        <httpRuntime executionTimeout="3000" maxRequestLength="204800" useFullyQualifiedRedirectUrl="false" />
      </system.web>  <!-- 部署服务库项目时,必须将配置文件的内容添加到 
      主机的 app.config 文件中。System.Configuration 不支持库的配置文件。-->
      <system.serviceModel>
        <services>
          <service name="WcfServiceLibrary1.Service1" behaviorConfiguration="WcfServiceLibrary1.Service1Behavior">
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:8731/Design_Time_Addresses/WcfServiceLibrary1/Service1/"   />
              </baseAddresses>
            </host>
                  
            <endpoint address="basic"  binding="basicHttpBinding" bindingConfiguration="mybasicHttpBinding" contract="WcfServiceLibrary1.IService1">
            
              <identity>
                <dns value="localhost"/>
              </identity>
            </endpoint>
           
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="WcfServiceLibrary1.Service1Behavior">
              <serviceMetadata httpGetEnabled="True"/>
              <serviceDebug includeExceptionDetailInFaults="False" />
            </behavior>
          </serviceBehaviors><behaviors>
          <endpointBehaviors>
            <behavior name="ServiceViewEventBehavior">
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
            </behavior>
          </endpointBehaviors>
        </behaviors>
        </behaviors>    <bindings>
          <basicHttpBinding>
            <binding name="mybasicHttpBinding" sendTimeout="00:10:00" maxBufferSize="655360000"
              maxBufferPoolSize="655360000" maxReceivedMessageSize="655360000"
              messageEncoding="Text">
              <readerQuotas maxDepth="320" maxStringContentLength="655360000"
                maxArrayLength="655360000" maxBytesPerRead="65536" maxNameTableCharCount="655360000" />
            </binding>
          </basicHttpBinding>
        </bindings>
        
      </system.serviceModel>
    </configuration>
      

  3.   

    放到 </system.serviceModel>上面一段试试?
      

  4.   


    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.web>
        <compilation debug="false" />    <!--将上传文档的大小控制在20M以内-->
        <httpRuntime executionTimeout="3000" maxRequestLength="204800" useFullyQualifiedRedirectUrl="false" />
      </system.web>  <!-- 部署服务库项目时,必须将配置文件的内容添加到 
      主机的 app.config 文件中。System.Configuration 不支持库的配置文件。-->
      <system.serviceModel>
        <services>
          <service name="WcfServiceLibrary1.Service1" behaviorConfiguration="WcfServiceLibrary1.Service1Behavior">
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:8731/Design_Time_Addresses/WcfServiceLibrary1/Service1/"   />
              </baseAddresses>
            </host>
                  
            <endpoint address="basic"  binding="basicHttpBinding" bindingConfiguration="mybasicHttpBinding" contract="WcfServiceLibrary1.IService1">
            
              <identity>
                <dns value="localhost"/>
              </identity>
            </endpoint>
           
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="WcfServiceLibrary1.Service1Behavior">
              <serviceMetadata httpGetEnabled="True"/>
              <serviceDebug includeExceptionDetailInFaults="False" />
            </behavior>
          </serviceBehaviors>
        </behaviors>    <bindings>
          <basicHttpBinding>
            <binding name="mybasicHttpBinding" sendTimeout="00:10:00" maxBufferSize="655360000"
              maxBufferPoolSize="655360000" maxReceivedMessageSize="655360000"
              messageEncoding="Text">
              <readerQuotas maxDepth="320" maxStringContentLength="655360000"
                maxArrayLength="655360000" maxBytesPerRead="65536" maxNameTableCharCount="655360000" />
            </binding>
          </basicHttpBinding>
        </bindings>
        <behaviors>
          <endpointBehaviors>
            <behavior name="ServiceViewEventBehavior">
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
            </behavior>
          </endpointBehaviors>
        </behaviors>
      </system.serviceModel>
    </configuration>
      

  5.   

    WindowsMobile开发常见问题集
      

  6.   

    这个要在客户端配置web.config,服务端配置是没用的
      

  7.   


    windows Mobile 客户端怎么配置web.config