如何从Flex代码向wcf服务发送更大的字节或通过wcf服务接收更大的字节 [英] How to send larger size of byte to wcf service from flex code or receive larger bytes by wcf service

查看:72
本文介绍了如何从Flex代码向wcf服务发送更大的字节或通过wcf服务接收更大的字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将图像转换为flex字节,然后将字节发送到wcf服务,当它较小时,它可以正常工作,但是当它较大时,它不起作用,并显示出皂响应错误或404错误....是我的WCF服务中的Web配置文件...



 <? xml version = "  ?> 
<  配置 > 
  <   system.web  > 
    <  编译    ="   true"  targetFramework   > 4.0"    / > 
     <  /system.web  > 
    <   system.serviceModel  > 
    <  行为 > 
      <   serviceBehaviors  > 
        <  行为 > 
          <!-  为避免公开元数据信息,请将以下值设置为否,并在部署之前删除上面的元数据终结点 ->  
          <   serviceMetadata     ="   true" > 
          <!-  要在故障中接收异常详细信息以进行调试,请设置下面的值为true.部署前设置为false以避免泄露异常信息 ->  
          <   serviceDebug     ="   false" > 
        <  /行为 > 
      <  /serviceBehaviors  > 
    <  /行为 > 
    <   serviceHostingEnvironment     ="   true" / <  /system.serviceModel  > 
 <   system.webServer  > 
    <  模块    ="   true" > 
  <  /system.webServer  > 
  <   system.net  > 
    <   mailSettings  > 
      <   smtp      ="  > 
        <  网络    ="   localhost" 端口  > 25"    用户名  =" " 密码  " ">> 
      <  /smtp  > 
    <  /mailSettings  > 
  <  /system.net  > 
<  /configuration  >  

<custombinding>        
        <binding name="LargeCustomBinding">
                 receiveTimeout="01:00:00" 
                 openTimeout="01:00:00" 
                 closeTimeout="01:00:00" 
                 sendTimeout="01:00:00">
          <binarymessageencoding>
            maxReadPoolSize="2147483647" 
            maxSessionSize="2147483647" 
            maxWritePoolSize="2147483647">
            <readerquotas>
              maxArrayLength="2147483647" 
              maxDepth="2147483647" 
              maxBytesPerRead="2147483647" 
              maxNameTableCharCount="2147483647" 
              maxStringContentLength="2147483647" />
          </readerquotas></binarymessageencoding>
          <httptransport>
            maxBufferSize="2147483647" 
            maxReceivedMessageSize="2147483647" 
            maxBufferPoolSize="2147483647"/>
        </httptransport></binding>
      </custombinding>


在我的wen配置中添加了这些行……算出来了..



< basichttpbinding>
< binding>
maxReceivedMessageSize ="2147483647" closeTimeout ="00:10:00" maxBufferPoolSize ="2147483647"
openTimeout ="00:10:00" receiveTimeout ="00:10:00" sendTimeout ="00:10:00" maxBufferSize ="2147483647"
>
< readerquotas>
maxDepth ="2147483647" maxStringContentLength ="2147483647" maxArrayLength ="2147483647" maxBytesPerRead ="2147483647" maxNameTableCharCount ="2147483647
"/>
<安全模式=无">



I am converting a image into bytes in flex and sending bytes to wcf service it works fine when it is in smaller size but when size is more it is not working and showing that soap response error or 404 error....here is my web config file which is in my wcf services...



<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
     </system.web>
    <system.serviceModel>
    <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"/>
          <!-- 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" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <system.net>
    <mailSettings>
      <smtp from="">
        <network host="localhost" port="25" userName="" password=""/>
      </smtp>
    </mailSettings>
  </system.net>
</configuration>

解决方案

I guess you are using WCF 4.0.In that you have to find out the tags that are used for configuration.here is a sample of configuration tags that are used in WCF3.0.You can try and look up in the web the same WCF 4.0

<custombinding>        
        <binding name="LargeCustomBinding">
                 receiveTimeout="01:00:00" 
                 openTimeout="01:00:00" 
                 closeTimeout="01:00:00" 
                 sendTimeout="01:00:00">
          <binarymessageencoding>
            maxReadPoolSize="2147483647" 
            maxSessionSize="2147483647" 
            maxWritePoolSize="2147483647">
            <readerquotas>
              maxArrayLength="2147483647" 
              maxDepth="2147483647" 
              maxBytesPerRead="2147483647" 
              maxNameTableCharCount="2147483647" 
              maxStringContentLength="2147483647" />
          </readerquotas></binarymessageencoding>
          <httptransport>
            maxBufferSize="2147483647" 
            maxReceivedMessageSize="2147483647" 
            maxBufferPoolSize="2147483647"/>
        </httptransport></binding>
      </custombinding>


Added these lines in my wen config......it worked out..



<basichttpbinding>
<binding>
maxReceivedMessageSize="2147483647" closeTimeout="00:10:00" maxBufferPoolSize="2147483647"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647"
>
<readerquotas>
maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647
"/>
<security mode="None">



这篇关于如何从Flex代码向wcf服务发送更大的字节或通过wcf服务接收更大的字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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