Azure WCF Webrole错误:远程服务器返回了意外的响应:(413)请求实体太大 [英] Azure WCF Webrole error: The remote server returned an unexpected response: (413) Request Entity Too Large

查看:74
本文介绍了Azure WCF Webrole错误:远程服务器返回了意外的响应:(413)请求实体太大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows Azure webrole(WCF)Web服务.我有一种将文件上传到Window Azure Blob存储的方法.这很好用,但仅适用于较小的文件(<30 Kb).

I have a Windows Azure webrole (WCF) webservice. I have a method to upload files to Window Azure blob storage. This works well, but only for small ( < 30 Kb) files.

<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服务时出现错误.

If this part: ByVal FileContent As Byte() is bigger than 30 Kb then I get an error when I call the webservice.

远程服务器返回了意外的响应:(413)请求实体太大.

The remote server returned an unexpected response: (413) Request Entity Too Large.

如果我通过调试在本地运行此Web服务,并且在它甚至无法到达的方法上设置了一个断点.

If I run this webservice local with debugging and I set a breakpoint on the method it doesn't even get there.

我找到了一些类似的主题,但是它们不在Windows Azure上下文中.

I found some simular topics, but they are not in a Windows Azure context.

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

The web.config in the WCF project is pretty empty.

推荐答案

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

In the system.serviceModel of the web.config of the (Windows Azure) WCF webrole webservice you can add basicHTTPBinding. The mistake I made was trying to add a name, but without name it appears to be a default. Now it works like a charm. Hope someone else runs into this and find his answer here. It took me four hours.

<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>

这篇关于Azure WCF Webrole错误:远程服务器返回了意外的响应:(413)请求实体太大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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