I pass some values to my WCF service from the .net application in string format. Passing string format will be in this structure,
ItemName~ItemDescription~ItemPrice|ItemName~ItemDescription~ItemPrice|...
Every line item will be separated by '|' character. I was passing nearly 1000 items. It was working as expected, but when I came to pass 1500 items, this error occurs.
The remote server returned an unexpected response: (413) Request Entity Too Large.
Please help me in fixing this error.
This is the method in service
private void InsertGpLineItems(string lineItems)
{
//Here I will process the insertion of line items to the GP system.
}
This is web.config at my WCF service.
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="connectionString" value="data source=localhost; initial catalog=TWO; integrated security=SSPI"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<pages validateRequest="false" />
<httpRuntime requestValidationMode="2.0" />
</system.web>
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging"
switchValue="Information, ActivityTracing, Error">
<listeners>
<add name="messages"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="messages.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true"
maxMessagesToLog="3000"
maxSizeOfMessageToLog="2000"/>
</diagnostics>
<services>
<service name="Service1.IService1">
<endpoint address="" binding="basicHttpBinding"
contract="Service1.IService1">
</endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:50935/Service1.svc"/>
</baseAddresses>
</host>
<!--<endpoint address="http://localhost:50935/Service1.svc" binding="basicHttpBinding"></endpoint>-->
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="SampleBinding"
messageEncoding="Text"
closeTimeout="00:02:00"
openTimeout="00:02:00"
receiveTimeout="00:20:00"
sendTimeout="00:02:00"
allowCookies="false"
bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
textEncoding="utf-8"
transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2000000"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="None"
proxyCredentialType="None"
realm="">
</transport>
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="behaviorGPLineItemsService">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>