【问题标题】:Azure WCF Webrole error: The remote server returned an unexpected response: (413) Request Entity Too LargeAzure WCF Webrole 错误:远程服务器返回了意外响应:(413)请求实体太大
【发布时间】:2013-02-07 16:04:19
【问题描述】:

我有一个 Windows Azure webrole (WCF) 网络服务。我有一种将文件上传到 Window Azure blob 存储的方法。这很好用,但仅适用于小 (

<OperationContract()>
Function UploadFileV1(ByVal ApplicationSessionGuid As String, 
                      ByVal UserSessionGuid As String, 
                      ByVal FileContent As Byte(), 
                      ByVal FileName As String, 
                      ByVal FileDescription As String, 
                      ByVal FileDisplayName As String, 
                      ByVal IsPublic As Boolean) As DataSet

如果这部分:ByVal FileContent As Byte() 大于 30 Kb,那么我在调用 Web 服务时会出错。

远程服务器返回意外响应:(413) Request Entity Too Large.

如果我在本地运行这个 web 服务并进行调试,并且我在方法上设置了一个断点,它甚至都没有到达那里。

我发现了一些类似的主题,但它们不在 Windows Azure 上下文中。

WCF 项目中的 web.config 非常空。

【问题讨论】:

标签: wcf azure-web-roles


【解决方案1】:

在 (Windows Azure) WCF webrole webservice 的 web.config 的 system.serviceModel 中,您可以添加 basicHTTPBinding。我犯的错误是尝试添加名称,但没有名称似乎是默认值。现在它就像一个魅力。希望其他人遇到这个问题并在这里找到他的答案。我花了四个小时。

<bindings>
  <basicHttpBinding>
    <binding maxReceivedMessageSize="2147483647"  maxBufferSize="2147483647" transferMode="Streamed"  >
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
      <security mode="None">
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-01-01
    • 1970-01-01
    • 2014-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多