We are using the C# REST API to submit actions and on occasion we are seeing an exception being thrown:
An exception occurred during a WebClient request. Unable to read data from the transport connection. The connection was closed.
This happens during Bresults = client.UploadData(resourceURI, bytes); in the postRest method.
I have found resources on StackOverflow that suggest extending the WebClient and setting the timeout and ProtocolVersion, but this even using this extended WebClient we still see the problem.
This exception is not thrown every time and out of 20 or 30 actions submitted we may only see it pop up once, but due to the nature of the actions being submitted we need to ensure that we have a way to address this. The action being submitted is always the same one using a sourced fixlet the only difference is the targets and parameters, so there’s no issue with it only happening certain fixlets or actions.
Because of the exception we have no way of knowing whether the action was submitted successfully or not. If I verify the action was submitted by checking the console, I see that it was submitted every time, so it seems that it’s an issue with the connection just being closed before a result is returned, but I don’t now how to correct that. We need the result because we need the Action Id in order to track progress.
Any help is greatly appreciated.