none
客户端配置不能改成流模式,请问是什么原因? RRS feed

  • 问题

  • 尝试做了一个很简单的从数据库查询图像的程序

    服务端的配置是这样

    <system.serviceModel>
        <services>
          <!--<service  behaviorConfiguration="StreamingServiceBehavior" name="Microsoft.ServiceModel.Samples.StreamingService"  >-->
          <service  name="Microsoft.ServiceModel.Samples.StreamingService"  >
          
           
          <endpoint  address="" binding="basicHttpBinding" bindingConfiguration="HttpStreaming" contract="IService1"/>
            <!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>-->
          </service>
        </services>

        <bindings>
           <!--an example basicHttpBinding using streaming-->
          <basicHttpBinding>
            <binding name="HttpStreaming"      maxReceivedMessageSize="9223372036854775807" transferMode="Streamed"/>
          </basicHttpBinding>
         
          
        </bindings>

        <behaviors>
          <serviceBehaviors>
            <behavior>
               <!--为避免泄漏元数据信息,请在部署前将以下值设置为 false 并删除上面的元数据终结点-->
              <serviceMetadata httpGetEnabled="true"/>
               <!--要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息-->
              <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>

        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
      </system.serviceModel>

    客户端的配置app.config

       <bindings>
                <basicHttpBinding>
                    <binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
                        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                        maxBufferSize="22265536" maxBufferPoolSize="222524288" maxReceivedMessageSize="22265536"
                        messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
                        useDefaultWebProxy="true">
                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                        <security mode="None">
                            <transport clientCredentialType="None" proxyCredentialType="None"
                                realm="" />
                            <message clientCredentialType="UserName" algorithmSuite="Default" />
                        </security>
                    </binding>
                </basicHttpBinding>
            </bindings>

    在客户端加入服务引用的时候,默认生成的客户端代理的配置,transferMode="Buffered",执行没有问题,改成"Streamed"后,执行就报错,请问是什么原因?



    • 已编辑 尺蠖 2013年10月31日 8:39
    2013年10月31日 8:37

答案

全部回复