• Register
1 vote

Problem :

Currently I am learning the use of HttpClient class. Also I have started using the HttpClient class to communicate with the web service in my current WPF application.

If I try to make the consecutive GET requests on my same connection then everything works perfectly. But if I try to make the consecutive PUT or PATCH requests on a same connection in this case only my first request executes accurately and also I receive the response correctly but my second request fails and it does not include any body in my request and then I receive the following error

"The server committed a protocol violation. Section=ResponseStatusLine".

I know it is a very common error but it has very few known solutions available which I have already tried. I have tried a solution which involves the setting a useUnsafeHeaderParsing property to the value as true and also set my Keep-Alive property to the value as false in my Web.Config. But somehow it is not working for me.

I am unable to fix above error. I am looking for somebody who can help me in fixing above error.

8 5 2
3,230 points

Please log in or register to answer this question.

1 Answer

1 vote

Solution :

I had also faced this issue in the past. After a lot of research on this error I realized my mistake was I was trying to edit my Web.Config file of my WPF application instead of my app.config file.

So if you want to fix above error then you must drop below code in your app.config file at a root of your configuration tag for your WPF application and it will surely fix your problem.

<httpWebRequest useUnsafeHeaderParsing = "true"/>


8 4
5,680 points

Related questions

1 vote
1 answer 398 views
Problem : Facing bellow error the server committed a protocol violation. section=responseheader detail=cr must be followed by lf
asked Nov 8, 2019 peterlaw 6.9k points
0 votes
1 answer 104 views
Problem : I am facing error on below step objUDMCountryStandards.Country = txtMySearchCountry.Text.Trim() != string.Empty ? txtMySearchCountry.Text : null; in the get grid data throws error as below : &ldquo;The calling thread cannot access this object because a different thread owns it.&rdquo; Is there anything wrong with my code?
asked Jan 7, 2020 alecxe 7.5k points
1 vote
1 answer 36 views
Problem : In the following step objUDMCountryStandards.Country = txtSearchCountry.Text.Trim() != string.Empty ? txtSearchCountry.Text : null; in get grid data throws the exception as below : The calling thread cannot access this object because a different thread owns it. What is wrong in my code?
asked Dec 28, 2019 alecxe 7.5k points
0 votes
1 answer 72 views
0 votes
1 answer 25 views
Problem: I have recently joined a new project in WPF C# and at this time I am trying to animate the image to simply move down. I have already found out the "MoveTo" function on an Internet but when I pasted it in my code then the below error occurred: &ldquo; ... button_Click(object sender, RoutedEventArgs e)     {         MoveTo(image, 130);     } } Kindly help me in fixing my above C# code.
asked Jul 28, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 33 views
I want some interview questions if someone can help it will reat.
asked Dec 4, 2020 Lucky Guy 1.4k points
0 votes
1 answer 191 views
Problem: I am very new to .Net programming. Recently I was trying to run the .Net socket server code on my Win7-64bit machine. But I am receiving the below error: System.Net.Sockets.SocketException: An address incompatible with the requested protocol was used. Error Code: 10047 ... -XP sp3 . I have already checked the error code details on MSDN but it does not make any sense to a beginner like me.
asked Aug 22, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 297 views
Problem : I have facing an issue with my C# PayTrace Gateway. My code was working fine until they turned off SSL3 due to the Poodle Exploit. When tried running my code I am getting the following message: The remote server has forcefully closed the connection. ... The client and server cannot communicate, because they do not possess a common algorithm. Any clue on error messages which I am facing?
asked Nov 29, 2019 alecxe 7.5k points
1 vote
1 answer 86 views
Problem : I want to retrieve some of the information from the ABB G13 gateway that offer the RESTful JSON API. API is hosted by a gateway via the https endpoint. Basic authentication mechanism is used for the authentication. However all the traffic goes through ... line 522, in send raise SSLError(e, request=request) requests.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:680)
asked Jan 2, 2020 alecxe 7.5k points
0 votes
1 answer 217 views
Problem : I am searching the working solution for following C# issue. only one usage of each socket address (protocol/network address/port) is normally permitted.
asked Nov 16, 2019 peterlaw 6.9k points