Getting HttpRequestExceptions: The response ended prematurely

You just need to keep digging. The exception “The response ended prematurely” isn’t the root cause. Keep digging into the inner exceptions until you find the last one. You’ll find this:

System.IO.IOException: Authentication failed because the remote party has closed the transport stream.

So it’s not about your code. It seems the server you’re hitting either can’t handle the load, or is intentionally dropping your requests because you’re hitting it too hard.

Leave a Comment