开发者

Sending a "larger" collection of data to an Azure WCF Service

开发者 https://www.devze.com 2023-02-05 12:55 出处:网络
I\'m trying to create a web service using Azure. For the time being, everything is being run locally. The web service and Azure work fine, a simple string Test() method which returns \"Hello world\"

I'm trying to create a web service using Azure.

For the time being, everything is being run locally. The web service and Azure work fine, a simple string Test() method which returns "Hello world" works without problems, as you'd expect. ;)

Now, I've created two methods which add rows to Azure Data Tables. The first sends (using a special DataContract) a single row of data, and this works fine.

The second is for sending larger amount of data, and sends an IEnumerable. So, to test the service, I've created a client application which creates a number of random data to send. If I create up to 42 rows and send that, all goes well.

Above that, I get a 400 Bad request error.

The problem is that there's no inner message to work with (or rather, that WAS the inner message). I strongly suspect it has to do with the size of the request however.

Note, that if I put a breakpoint on the service's method, it doesn't even get that far. I've read quite a few various forum posts regarding similar issues, but those seemed to deal with ordinary WCF services, not Azure ones, and so the Web.config file doesn't contain definit开发者_Python百科ions for bindings nor endpoints, which would be something I could work with.

Please help.

PS. I realise I may have posted very little information. If something else is needed, please ask, and I'll do my best to include it.


Adding the following lines to the Web.config file (under system.serviceModel) in the Azure service project (NOT the Web.config in the client application) resolved the issue:

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

精彩评论

暂无评论...
验证码 换一张
取 消