首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web Service >

WCF下传10M的文件报错

2012-12-15 
WCF上传10M的文件报错Client 配置如下:contractFileUitl.IFileUploadService nameWSHttpBinding_IFil

WCF上传10M的文件报错
Client 配置如下:


                contract="FileUitl.IFileUploadService" name="WSHttpBinding_IFileUploadService">
                <identity>
                    <userPrincipalName value="" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>



服务端配置如下:

<system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="MTMOBinding" messageEncoding="Mtom" transactionFlow="True" useDefaultWebProxy="True" bypassProxyOnLocal="False" hostNameComparisonMode="StrongWildcard"
                 textEncoding="utf-8" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
          <readerQuotas maxDepth="32" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="UploadWcfService.UpLoadServiceBehavior" name="FileUploadService">
        <endpoint address="http://localhost:50268/FileUploadService.svc" binding="wsHttpBinding" bindingConfiguration="MTMOBinding"
          contract="HQ.Server.Test.IFileUploadService"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="UploadWcfService.UpLoadServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
        <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 aspNetCompatibilityEnabled="false"
       multipleSiteBindingsEnabled="false" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>



报错信息:
An error occurred while receiving the HTTP response to http://localhost:50268/FileUploadService.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down)
[最优解释]
1.修改IIS文件上传大小限制,具体操作见如下
http://www.cnblogs.com/henryhappier/archive/2010/09/20/1832098.html

2.更改服务端CONGFIG文件,添加如下代码
<httpRuntime maxRequestLength="2147483647" executionTimeout="36000"/>

热点排行