【问题标题】:Sending a "larger" collection of data to an Azure WCF Service将“更大”的数据集合发送到 Azure WCF 服务
【发布时间】:2011-01-18 15:48:16
【问题描述】:

我正在尝试使用 Azure 创建 Web 服务。

目前,一切都在本地运行。 Web 服务和 Azure 工作正常,返回“Hello world”的简单 string Test() 方法可以正常工作,正如您所期望的那样。 ;)

现在,我创建了两种向 Azure 数据表添加行的方法。第一个发送(使用特殊的DataContract)单行数据,这工作正常。

第二个是发送大量数据,发送IEnumerable。因此,为了测试服务,我创建了一个客户端应用程序,它创建了许多要发送的随机数据。如果我创建最多 42 行并将其发送,一切顺利。

除此之外,我收到400 Bad request 错误。

问题在于没有可使用的内部消息(或者更确切地说,是内部消息)。我强烈怀疑这与请求的大小有关。

请注意,如果我在服务的方法上设置断点,它甚至不会达到那么远。我已经阅读了很多关于类似问题的各种论坛帖子,但那些似乎处理普通 WCF 服务,而不是 Azure 服务,因此Web.config 文件不包含绑定或端点的定义,这将是我的可以使用。

请帮忙。

PS。我意识到我可能发布的信息很少。如果需要其他内容,请询问,我会尽力提供。

【问题讨论】:

  • 你在开发 Dev Fabric 吗?
  • 是的,我是。 (该死的字符限制>.

标签: c# visual-studio-2010 .net-4.0 azure wcf


【解决方案1】:

将以下行添加到 Azure 服务项目中的 Web.config 文件(system.serviceModel 下)(不是客户端应用程序中的 Web.config)解决了该问题:

<bindings>
  <basicHttpBinding>
    <!--The basicHttpBinding is used for clients which use the generated code to transmit data; the following
  settings make it possible to send larger amounts to the service-->
    <binding maxReceivedMessageSize="10000000" receiveTimeout="01:00:00">
      <readerQuotas maxStringContentLength="10000000" />
    </binding>
  </basicHttpBinding>
</bindings>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多