2

I know this is a redundant question, I am getting the error while I am uploading the a file which is more than 100 KB.

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

I am posting the content to a WCF Service (64 bit environment). Am aware this should have been resolved with managing maxReceivedMessageSize and relevant behaviours but unfortunately its not.

Below is my configurations :-

Client

 <binding allowCookies="false" bypassProxyOnLocal="false" closeTimeout="00:01:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" name="BasicHttpBinding_ICandidateManagementService" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:11:00" textEncoding="utf-8" transferMode="Streamed" useDefaultWebProxy="true"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> <message algorithmSuite="Default" clientCredentialType="UserName"/> </security> </binding> <behavior name="CandidateBehavior"> <dataContractSerializer maxItemsInObjectGraph="2147483647" /> </behavior> <endpoint address="http://localhost:62368/CandidateManagementService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICandidateManagementService" contract="MMJ.ServiceContracts.ServiceContract.ICandidateManagementService" name="BasicHttpBinding_ICandidateManagementService" behaviorConfiguration="CandidateBehavior" /> 

Service

<services> <service name="BasicHttpBinding_ICandidateManagementService" behaviorConfiguration="CandidateBehavior"> <endpoint contract="MMJ.ServiceContracts.ServiceContract.ICandidateManagementService" binding="basicHttpBinding" address="" bindingConfiguration="BasicHttpBinding_ICandidateManagementService"/> </service> 

I have seen possibly everything available and still cant solve this issue. have also tried using below configuration, but still no change...

<serverRuntime uploadReadAheadSize="500000000" maxRequestEntityAllowed="500000000"/> 

Kindly help!

Service binding Config (its same as client)

<binding allowCookies="false" bypassProxyOnLocal="false" closeTimeout="00:01:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" name="BasicHttpBinding_ICandidateManagementService" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:11:00" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="32" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> <message algorithmSuite="Default" clientCredentialType="UserName"/> </security> </binding> 

To give more insight below is the fiddlers finding :-

Request Count: 1 Bytes Sent: 85,719 (headers:697; body:85,022) Bytes Received: 10,129 (headers:254; body:9,875)

3
  • I thought you also needed to set some things in IIS but don't know for sure. Commented Mar 11, 2013 at 13:40
  • I don't think so, let me know if you come across any. Commented Mar 11, 2013 at 16:14
  • I retrieved the same error on Chrome. When I switched to Firefox all issues dissapeared. Commented Dec 16, 2016 at 19:13

3 Answers 3

3

At last my problem is resolved after struggling a lot. I had a flaw in my Service config, which was not giving me any runtime or compile time error as it was not even recognizing the config.

My Service Config was :-

<services> <service name="BasicHttpBinding_ICandidateManagementService" behaviorConfiguration="CandidateBehavior"> <endpoint contract="MMJ.ServiceContracts.ServiceContract.ICandidateManagementService" binding="basicHttpBinding" address="" bindingConfiguration="BasicHttpBinding_ICandidateManagementService"/> </service> 

I have the "Name" property which is not fully qualified name of my service, and thus the configuration I used was not even considered and thus was taking default 65KB for maxReceivedMessageSize.

I have updated it and its working like a charm.

<services> <service name="MMJ.Services.CandidateManagementService"> <endpoint contract="MMJ.ServiceContracts.ServiceContract.ICandidateManagementService" binding="basicHttpBinding" address="" bindingConfiguration="BasicHttpBinding_ICandidateManagementService"/> </service> 

Also, have a look at this post for more reference. I know this was a silly mistake, and thanks everyone for putting an effort to fix.

Sign up to request clarification or add additional context in comments.

1 Comment

Your question was helpful for me. I had the same problem but solved just using maxReceivedMessageSize="2000000".
1

You're posting the data to the server, so updating the client settings won't help. The client is not the one receiving the large message, the server is.

3 Comments

I agree... i already have updated the server configs. Its still not yielding any results.
Can you post the "BasicHttpBinding_ICandidateManagementService" portion of the config?
Thanks for the help Rich... I did eventually solved the issue.
0

Looking at your client endpoint:

Shouldn't the bindingConfiguration be

bindingConfiguration="BasicHttpBinding_ICandidateManagementService" 

Instead of

bindingConfiguration="BasicHttpBinding_IAdminService" 

3 Comments

That's just a typo error in the question, I am using the correct config.
Are you streaming or buffering for your transfer mode(are your parameters/response stream type)? According to your configs, you are doing buffered on service, but streaming on client. I think that they both have to be the same on each end otherwise how it is it going to know how to chunk it accordingly? Have you/can you try making them the same and giving it another shot to see if that works?
I checked it, am using buffered at both server and client. As there is no concept of streaming in my implementation.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.