The server committed protocol violation
Sometimes you have to love the error messages that point you to direction that has nothing to do with the cause of the
problem. Recently i was assigned another debugging task. Only information I had with me was a screen shot that showed
the wonderful ASP.Net yellow error page telling "The server has committed protocol violation." and under that stack trace.
I started with my routine debugging steps. I asked the reporter of the error if there was any change in the code or enviironment
that happened recently. I came to know that same application is working fine on 4 other servers and this was a new server that
was brought online. This kind of indicated that there is nothing wrong with any piece of code, this is something environmental.
The I used my favorite search engine to see if this is some kmown issue. Violla, there are whole bunch pf postings about this issue
and most important that struck me was that it is due to a .Net framerwork SP that headers are processed more strict that they used
to be. And other most important observation was that most of these issues were reported because of usage of direct HttpWebRequest calls
from within the applications. Thats when I looked at the stack trace and relaized that application uses a third party component
that calls into a web service.
Looking further at the stack trace, I realized that component is not able to send SOAP request to web service on our server. Thats when
it clicked it is definitely some environmental issue. It turned out that web service was not configured correctly and was not accepting
any requests from clients.
The lessons we learned form thsis incident about this error was:
- If its happening on only one server, then it is most probably environmental or configuration issue
- Check if there is a web service request sent from with in application
- Check if the target web service is configured correctly and running.
A lot of people suggested a solution by adding following configuration parameter in web.config
<httpWebRequest useUnsafeHeaderParsing="true" />
I personally did not like this solution because it may provide immediate relief but may hide the real problem. So
before you adopt this setting, investigate the problem and try to fix it the right way.