Reputation: 4503
I'm trying to build a WCF service which will allow users to upload a file, files will be limited to max size of 2mb. I'm passing a byte[] over to the service, but keep getting the following error: System.Net.WebException: The remote server returned an error: (413) Request Entity Too Large.
I'm able to send over files of 1kb and 10kb, but when i try larger ones like 82kb, i get that error. I've looked through some previous posts but can't seem to locate what i'm doing wrong, i've tried to adjust the setting in my config as well, setting max values to see if that would help, but nothing is working so far. can someone look at what i have and see if i'm missing something, or is this something related to IIS (7.5) not my web.config?
Also this is not using SSL.
WCF config:
<services>
<service name="DSLDService.DSLDService">
<endpoint binding="basicHttpBinding" bindingConfiguration=""
contract="DSLDService.IDocument" />
</service>
</services>
Web Application config:
<endpoint address="http://xxx/DSLDService/DSLDService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDocument"
contract="DSLDServiceReference.IDocument" name="" />
and
<binding name="BasicHttpBinding_IDocument" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
</binding>
Thanks.
Upvotes: 3
Views: 7722
Reputation: 4156
You need a binding configuration for you service as well as the client (which is what you got right now), where you define the max sizes otherwise its defaulted to 64 kb.
Upvotes: 1