Reputation: 3004
My Client web.config has :
<behaviors>
<endpointBehaviors>
<behavior name="dataConfiguration">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ISchedulingService" closeTimeout="01:10:00"
openTimeout="00:11:00" receiveTimeout="01:10:00" sendTimeout="01:10:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:1234/SchedulingService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISchedulingService"
behaviorConfiguration="dataConfiguration" contract="SchedulingService.ISchedulingService" name="BasicHttpBinding_ISchedulingService" />
</client>
And HostApp web.config has :
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="2147483647"/>
</system.web>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="dataConfiguration">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing m7tadata 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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
And ServiceApp web.config has :
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="2147483647" executionTimeout="14400"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- increase the size of data that can be serialized -->
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<!-- 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>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
Now,
In my Controller method in client, I tried to pass to the service
* List of 3600 string[] to service
and
* Instead, A string of 3600 row details separated by a delimiter (Excel parsed sheet)
(PS : There are 12 string values for each row (and total rows = 3600))
But I keep getting :
The remote server returned an unexpected response: (413) Request Entity Too Large.
Even for 200 row upload.
Please guide. Thanks
Upvotes: 0
Views: 1103
Reputation: 3004
It still threw the same error for even 200 records list... So finally I decided to call the same in chunks rather at once..
thanks for guiding
int chunkSize = 100;
for (var i = 0; i < Details.Count; i += chunkSize)
{
List<List<string>> DetailsChunk = schoolDetails.Skip(i).Take(chunkSize).ToList();
result = scheduleClient.AddDetails(DetailsChunk, savedFileName);
}
Upvotes: 0
Reputation: 28530
You do not have any bindings or endpoints explicitly defined in the service's config file, so you are getting a default endpoint with basicHttpBinding
, with default values for the binding. Try either a) defining a basicHttpBinding
in the service config and assigning it to an explicitly defined endpoint or b) define a default basicHttpBinding
that will be used for all services that use that config file.
Option a
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ISchedulingService" closeTimeout="01:10:00"
openTimeout="00:11:00" receiveTimeout="01:10:00"
sendTimeout="01:10:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="SchedulingService">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_ISchedulingService"
contract="SchedulingService.ISchedulingService"
name="BasicHttpBinding_ISchedulingService" />
</service>
</services>
In the above configuration, a basicHttpBinding
is defined with the name "BasicHttpBinding_ISchedulingService", and this definition is assigned to the service endpoint via the bindingConfiguration
attribute of the <endpoint>
element.
Option b
Similar to option a above, except the binding congifuration section omits the name
attribute, and no service endpoint is defined. The defined binding configuration will be used for all services that use basicHttpBinding
unless overridden for an explicitly defined endpoint via the bindingConfiguration
attribute.
<bindings>
<basicHttpBinding>
<binding closeTimeout="01:10:00" openTimeout="00:11:00"
<!-- Remaining binding conifguration snipped for brevity -->
</binding>
</basicHttpBinding>
</bindings>
Upvotes: 1