-1

I am uploading an Excel file to SQL DB. I am getting Remote Server returned an error Not Found 404 exception at following line

WebResponse response = request.GetResponse(); 

This is REST POST call & service is configured properly. Can anyone help ?I am not able to figure out anything from Exception.

The same code is working with less amount of data I mean 200 list count. Any help would be appreciated.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Gyandeep
  • 119
  • 1
  • 11

3 Answers3

0

It looks like C# imposes some restriction by default.

Here are some ways to modify this setting,

https://stackoverflow.com/a/12573344/3131696

Community
  • 1
  • 1
M22an
  • 1,242
  • 1
  • 18
  • 35
  • Thank you M22an. I checked my IIS settings. It is set it as : Maximum allowed content bytes 30000000 – Gyandeep Oct 25 '15 at 17:28
0

While you are sending the request, you may want to check for MaxContentLength limit. Setting on config level just wont help, you need to set it at the code level where you are initializing the request.

Please refer this : Maximum request length exceeded

Community
  • 1
  • 1
Aj B
  • 1
  • 1
0

Try this in your web.config

           <webHttpBinding>
              <binding maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferPoolSize="524288">
              <readerQuotas maxDepth="32" maxStringContentLength="2147483647" 
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"  />
             </binding>
          </webHttpBinding>

Though these values above maximum so you may want to change them as per your requirement (to prevent Denial-of-Service attacks).

See this as well: webHttpBinding

JSK
  • 583
  • 6
  • 17