Getting error- 20152–500 Internal server Error (Data is invalid.) while accessing a web application published through TMG server.

In this scenario, TMG admin had published a web application through the TMG server, There was client side application as well on the clients, when users access the application using this client piece, they were getting error

“error- 20152–500 Internal server Error (Data is invalid.)” in a window apart from the name of the application in the error message.

TMG admin had noticed in the TMG live logs that they were getting “status 13 -data invalid”

 

 Data analysis and Troubleshooting.

We collected TMG data packager from the TMG server ,while trying to connect from the client. In the Data, I tracked the client’s request in the TMG live logs, where we were getting result code as 13, then using the corresponding Request id in the live logs ( i have explained this technique in this blog post of mine, https://blogs.technet.com/b/sooraj-sec/archive/2012/11/07/data-analysis-using-with-tmg-data-packager.aspx).

Then In the TMG trace found following

***********************************************************************************************************************************

Info:0000000038EEA540: the client ask for compression different than gzip. The filter remove it

Info:Filter called GetServerVariable: 'IS_CHUNKED_REQUEST', Context:0000000038EEA540

Info:[GetHeader]:'Transfer-Encoding:' - the requested header wasn't found.

Info:[GetServerVariable]:'IS_CHUNKED_REQUEST' - Returned value:'0', Context:0000000038EEA540

Entering CalcRequestContentLengthInfo:Filter called GetServerVariable: 'REQUEST_CONTENT_LENGTH', Context:0000000038EEA540

Info:[GetHeader]: 'Content-Length:', Returned Value: 'xxxx,xxxx'.

Info:[GetServerVariable]:'REQUEST_CONTENT_LENGTH' - Returned value:'xxxx,xxxx' , Context:0000000038EEA540

ERROR:pContentLength->FromDecimalString(xxxx,xxxx) failed, hr=0x8007000d(ERROR_INVALID_DATA) .

ERROR:CalcRequestContentLength() failed dwError = 13(ERROR_INVALID_DATA)

ERROR:OnClientPreProcHeaders() failed dwError = 13(ERROR_INVALID_DATA)

Info:Rejecting the request

Info:WPPISAPUBLIC:Returning error text "The data is invalid. " for error code 13(ERROR_INVALID_DATA)

Noise:WPPISAPUBLIC: (x.x.x.x:xxxx <== x.x.x.x:xxxx), xxxx bytes, "HTTP/1.1 500"

--------------------------------------------------------

Info: WPPISAPUBLIC:Context property:Cache info = 0x0

Info: WPPISAPUBLIC:Context property:Error info = 0x200

Info: WPPISAPUBLIC:Context property:Filter info = Req ID: xxxxxx

Info: WPPISAPUBLIC:Context property:Result code = 13

Info: WPPISAPUBLIC:Context property:Response source = 0x00000000(fpcSrcUnknown)

*******************************************************************************************************

It seemed that the client application was asking for compression method other then gzip and then TMG was not able to understand and was failing to calculate the content-length, Once I explained that to the TMG admin, they removed the content-length header from the client application side and then tested and after that issue did not happen.

Ideally they should have configured the client application with gzip compression but they went with removal of content-length header. But I guess they were happy with the outcome.