Getting 'Request_Cancelled' in %windir%\System32\LogFiles\HTTPERR from iOS device - c#

We are trying to find out why background requests to a particular endpoint (http or https) is never getting to IIS. The IIS logs show other requests from our device but none from our background requests. They do show in the HTTP.SYS logs though with no error code, just a 'Request_Cancelled'
Under a different environment in test these requests do work as expected. So the only differences seem to be firewall settings or something we haven't found yet.
Having searched for possible causes I have seen information about possible invalid SSL certificates. We current don't use https for where we are experiencing the issue, and in test we have tried both successfully. Another possible cause may have been latency, so we tried adding a 10 second delay to all requests in test and this also worked as expected.
What could other causes of this error be, and preventing a request to IIS?

I think its a bit difficult to find the root cause for Request cancelled.
You could try to capture and analyze http.sys etl log.
How to capture http.sys etl log.
run CMD.EXE with administrator
use cd c:\etl to locate your folder that you want to place etl log
Run logman start httptrace -p Microsoft-Windows-HttpService 0xFFFF -o httptrace.etl -ets
Try to reproduce the problem
Stop the trace with command logman stop httptrace -ets
Then you should see an .etl file displayed there
How to analyze these logs.
1.Download and install MS network monitor:
https://www.microsoft.com/en-us/download/details.aspx?id=4865
2.Open the etl log with network monitor
3.Select Parser Profiles->network monitor parser->Windows on upper right corner
4.Then you should be able all events happened when you access the endpoint from IOS.
Since we can't find much document about how to troubleshooting request_cancelled error. Maybe analyze http.sys etl would be a good beginning

I've just experienced a similar issue with a vendor-supplied application - one of the XHR requests failing with the web server just abandoning the connection. The IIS log records the request as successful (200), but the HTTPERR log reporting it as "Request_Cancelled".
In my case, this was the result of a response limit applied by the vendor in the web.config (specifically: configuration/system.serviceModel/behaviors/serviceBehaviors/behavior/dataContractSerializer#maxItemsInObjectGraph - as soon as the number of objects serialised in a single response exceeded this, the request got cancelled), and removing this limit allowed the application to work correctly.
Whilst this obviously isn't going to be the same for all cases of unexpected 'Request_Cancelled's, it may be worth checking both your web.config as well as your system-wide C:\Windows\System32\inetsrv\config\applicationHost.config for anything that limits the size of the response.

Related

C# OData The server committed a protocol violation. Section=ResponseStatusLine

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.
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:
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;
Ignore corrupted/missing headers. Ref: Link
Stop skype if it is running on the machine.
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.
Check the end point of your request server. ex:https or http.

RabbitMQ requires a PC restart or service restart to send messges

RabbitMQ seems to be in a weird state. We install RabbitMQ and Erlang, one of its pre requsite in our application. When trying to send message in the queue, it throws us exceptions thus the queue is just filling up. We need to either reboot the PC or restart the RabbitMQ server to start sending the message again.
Note - I don't have any logs and know what is exact exception as this happened in our during installation at customer site ad we have no access to them. This issue was found happening only at customers site in many of the platforms.
I require suggestions as to what may cause such use case. Is there a way i can test for weird state of rabbitmq and restart them in such use case from code. Or any generic way to handle from code ?

See Raw Response to a WCF Call

I'm building out a simple C# application that integrates with a SOAP web service. I add the service reference to the appropriate WSDL and everything works out fine so far.
Occasionally, the server's firewall will respond with a 503 error before the request gets a chance to hit the web service. That 503 error also contains some HTML with an ID number (which changes each time) that I want to capture.
If I catch the exception, it doesn't give me the full message - just the re-formatted basic exception that says the server is too busy.
I tried the message inspectors suggestion from this post:
Intercept SOAP messages from and to a web service at the client
...and it gives me the outbound request, but it never hits the AfterReceiveReply call, so the response isn't captured.
I've also tried subscribing to all of the channel's major events (Faulted, Opening, Opened, UnknownMessageReceived, etc), and I've tried inspecting the channel when I catch the exception, but nothing seems to work.
Any thoughts or suggestions?
Why not just run fiddler on the machine your soap client is running on and intercept and inspect the traffic that way?
Turn on WCF Tracing. In particular, Message Logging.
It seems like disabling SOAPProcessing in the .config file may be a step in this direction, but I was unable to figure out how to enable this setting via code (and I cannot use a .config file in my final application because this is a plugin and the parent app's .config file is dynamically generated each launch).
I was able to work around this somewhat. In my situation, I had separate dev and production servers. The 503s errors were happening mostly on the production server (likely due to the firewall being sensitive about a different hostname in the API requests), so I ended up with a solution that duplicated the API requests and sent them over to the production server.
(This was okay, because the production server was not configured with anything that would be affected by any API requests that made it through the firewall. The requests would just be considered invalid.)
I did this by using message inspectors to generate the last outgoing request. Then for each outgoing request, I generated a new WebBrowser control, set the proper headers (SOAPAction and all that), re-injected the security credentials (the message inspector stripped them out at runtime), and then posted the request to the production server with that WebBrowser control. The WebBrowser instance's DocumentCompleted event let me dump the result and search for the ticket ID when appropriate.
Not exactly glamorous, but it works well.

Data Power Connectivity Errors

All
At times, when sending a request to our web service DataPower sends failure alerts wit the below error codes/messages
0x01130006: Failed to establish a backside connection
0x01130011: Failed to process response headers
I am not sure why this is happening, but I would guess the request is too big to process by DataPower, times out, and sends failure messages to the application.
I found a forum suggesting to increase the thread count max on the Websphere servers, but it was never confirmed to be a working [or non working] solution.
I would like to know if someone has successfully resolved this issue with the above mentioned solution, or what other successful solutions are there.
Thanks
Might be that someone trying to reach not excited uri .
The error say faild established backside connection.
There could be several reasons for it namly,
1. You have conflicting routing information in datapower routing table about back end systems. In this case appliance will sometimes able to connect with backend and sometimes not.
2. The backend server is not able to respond in appropriate time [try to increase the 'back side timeout value].
To accuratly debug the issue you need to post the packet trace between datapower and backend systems [along with src and target IPs you are connecting to].
Are you also using load balancer on datapower to connect with backend?
Ajitabh

WPF HTTPWebRequest The underlying connection was closed: An unexpected error occurred on a receive

Firstly, there are a number of other similar questions and I have read them all and they have a similar problem however they differ from my problem:
In a WPF client application I am making several HttpWebRequests to various websites. On one particular machine and for one particular website I receive the following error, however only intermittently, approximately once every 4 or 5 requests:
System.Net.WebException
The underlying connection was closed: An unexpected error occurred on a receive.
at System.Net.HttpWebRequest.GetResponse()
and the status on the Request is ReceiveFailure.
Here's what I've tried:
Changing the timeout to be very high, turning off keep alive and using http 1.0 instead of 1.1, all of which don't change the problem
Running through a proxy to see what was going on but for some strange reason this problem doesn't happen when I run the exact same code through a proxy (by setting the proxy object on the http web request)
I can access the site no problem with IE and chrome
Tried another machine inside on my home network and had no problems. Similarly with another machine outside of the network.
This problem happened after upgrading this machine to Win7 however after going back to WinXP the problem is still ocurring.
Any help is greatly appreciated, all of the other posts either were for people talking to their own webservices and it was an ASP configuration problem or something like that. The site I am making requests too is an ASP site but I don't believe its a problem with the 3rd party site as this exact same code works on other machines just not one particular one.
A ReceiveFailure status means that your application started receiving the response but it was closed before the complete message was received for some reason.
Since you've already changed the timeout etc with no success the problem might be the server is closing the response stream prior to a complete response for some reason. Isolated to a specific machine might indicate a possible hardware issue or configuration on that particular machine. The fact that it's only for one website on the machine indicates configuration rather than hardware. Is there something different on that machine? Updates? IIS configuration?
It might be working through IE, Chrome and the Proxy because those would have some error handling already built in (IE and Chrome would definitely have error handling and retry the requests, I assume the proxy would too). You may have to build some of this error handling into your code.

Categories