【问题标题】:how to pass large data to service layer using wcf service?如何使用 wcf 服务将大数据传递到服务层?
【发布时间】:2012-09-19 00:39:58
【问题描述】:

我正在尝试在我的一个 Web 应用程序中实现附件功能。它有三层。演示、业务和服务层,我在附件字段的数据库中有 blob 数据类型....在将数据从业务层传输到服务层时出现错误。

The remote server returned an unexpected response: (400) Bad Request

即使我尝试增加数组长度、缓冲区大小等,我也找不到任何解决方案......但仍然出现错误......所以如果有人有任何想法,请帮助我......我从 5 天开始就面临这个问题。 ....

这是我的 web.config 设置

<binding name="BasicHttpBinding_ITestService" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="83886080" maxBufferPoolSize="83886080" maxReceivedMessageSize="83886080"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          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>

【问题讨论】:

    标签: asp.net wcf file-upload


    【解决方案1】:

    需要使用 WCF 流来上传大文件。但是,所使用的方法仍然存在一些限制。所以通过 HTTP 传输大文件需要很多考虑。详细示例和注意事项已在以下链接中发布。 http://garfoot.com/blog/2008/06/transferring-large-files-using-wcf/ http://kjellsj.blogspot.com/2007/02/wcf-streaming-upload-files-over-http.html

    【讨论】:

      【解决方案2】:

      您需要使用 WCF 流来上传大文件。但是,所使用的方法仍然存在一些限制。所以通过 HTTP 传输大文件需要很多考虑。 详细示例和注意事项已在以下链接中发布。

      1. http://garfoot.com/blog/2008/06/transferring-large-files-using-wcf/
      2. http://kjellsj.blogspot.com/2007/02/wcf-streaming-upload-files-over-http.html

      【讨论】:

        【解决方案3】:

        通过在 WCF 主机的配置文件中添加以下部分来打开服务器端的 WCF 跟踪。您将能够从跟踪文件中获得更具体的失败原因。

        <system.diagnostics>
            <trace autoflush="false"/>
            <sources>
              <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
                <listeners>
                  <add name="sdt" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\temp\ServiceTrace.svclog"/>
                </listeners>
              </source>
            </sources>
        </system.diagnostics>
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2013-03-12
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-08-19
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多