5

I'm accessing Dynamics 365 Business Central OData API in C# application, and when accessing data in my local system is good and when we deployed the application to client server, randomly (50%) they are getting the error "The server committed a protocol violation. Section=ResponseStatusLine".

I have checked the article https://techcommunity.microsoft.com/t5/iis-support-blog/protocol-violation-section-responsestatusline/ba-p/1227792 and applied all the 3 suggestions, but none of them worked.

I'm able to access the client Business Central API integration application in my local system without any issues.

Assuming that this is client Firewall or load balancer issue. But not able to find the solution.

Magento Nav
  • 119
  • 9

1 Answers1

0

There are many case behind this issue, avoiding the problem rather than actually fixing it. One of the most common cause of this error is the corrupt or missing headers in the request.

Solution:

  1. The server responds with a 100 continue in an incorrect way. Setting expect 100 continue to false and reducing the socket idle time to two seconds
HttpRequestObj.ServicePoint.Expect100Continue = false; 
HttpRequestObj.ServicePoint.MaxServicePointIdleTime = 2000; 
  1. Ignore corrupted/missing headers. Ref: Link

  2. Stop skype if it is running on the machine.

  3. If a webserver uses UTF-8 that outputs the byte-order-marker (BOM). For example, the default constant Encoding.UTF8 outputs the BOM, and it is easy to forget this. The webpages will work correctly in Firefox and Chrome but HttpWebRequest will bomb. A quick fix is to change the webserver to use the UTF-8 encoding that doesn't output the BOM.

  4. Check the end point of your request server. ex:https or http.

MD. RAKIB HASAN
  • 3,670
  • 4
  • 22
  • 35
  • All the five points are not applicable. I'm connecting Business central API through OData Connected Services, not sending request through httprequest. Skype is not running, and Business Central API's are HTTPS. And in the second point link, already specified all the options and not working. – Magento Nav Feb 11 '22 at 12:16