How to handle error 0x800703E3, when user cancells file download

Recently at work I came across a difficult error, that gives an error message, that would lead me nowhere.

The remote host closed the connection. The error code is 0x800703E3.

I’ll give you more context – error occurs in the micro-service that serves big files across the web with REST interface. Service was working perfectly and none of our clients rose issues. But something was wrong. After some hours I finally managed to reproduce it. The error occurred when client was downloading file, but intentionally canceled it. How to handle such situation? Exception did not have any distinct type that can be handled separately.

In odrer to handle it in ASP.NET MVC properly I added an exception logger:

And WebExceptionLogger class implementation:

I noticed that this specific error type has HResult = -2147023901, so this is what I’m filtering by.

Hope this helps you.

Leave a Reply

Your email address will not be published. Required fields are marked *