Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
while uploading a 98 mb file to wcf service i'm getting bellow error
Quote:
The remote server returned an unexpected response: (413) Request Entity Too Large.


web.config

<pre>-<system.serviceModel>

<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>


-<services>


-<service behaviorConfiguration="WcfService1.Service1Behavior" name="MyFileServer.Service1">


-<endpoint contract="MyFileServer.IService1" bindingConfiguration="TransactionalBind" binding="wsHttpBinding" address="">


-<identity>

<dns value="localhost"/>

</identity>

</endpoint>

<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/>

</service>

</services>


-<bindings>


-<wsHttpBinding>


-<binding name="TransactionalBind" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" transactionFlow="true">

<readerQuotas maxNameTableCharCount="2147483647" maxBytesPerRead="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647" maxDepth="2147483647"/>

<security mode="None"/>

</binding>

</wsHttpBinding>

</bindings>


-<behaviors>


-<serviceBehaviors>


-<behavior name="WcfService1.Service1Behavior">

<serviceMetadata httpGetEnabled="true"/>

<serviceDebug includeExceptionDetailInFaults="true"/>

</behavior>

</serviceBehaviors>

</behaviors>

</system.serviceModel>
XML



What I have tried:

Open IIS Manager
Select the site
Double click "Configuration Editor"
Select system.webServer and then serverRuntime
Modify the uploadReadAheadSize value
Click "Apply"
Posted
Updated 17-Apr-20 8:33am

1 solution

Have you checked the BasicHttpBinding.MaxReceivedMessageSize Property? By default is it set to 64MB
Property Value

Int64: The maximum size, in bytes, for a message that is processed by the binding. The default value is 65,536 byt
This can be set in the app.config file
XML
<configuration>
	<system.serviceModel>
		<bindings>
			<basicHttpBinding>
				<binding name="Binding1" maxReceivedMessageSize = "1000000">
					<security mode="None" />
				</binding>
			</basicHttpBinding>
		</bindings>
	</system.serviceModel>
</configuration>

Reference:
BasicHttpBinding.MaxReceivedMessageSize Property (System.ServiceModel) | Microsoft Docs[^]
 
Share this answer
 
Comments
#realJSOP 18-Apr-20 6:46am    
You've replied with "1" twice. WTF does that even mean?
MadMyche 18-Apr-20 6:53am    
I had 7 notifications for this when I woke up, this "1" as a comment on quite a few of my posts
kedar001 18-Apr-20 12:13pm    
same here
kedar001 18-Apr-20 2:13am    
Configured maxReceivedMessageSize="2147483647"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900