Custom Vision C# Prediction API gives HttpRequestException

VA 1 Reputation point
2021-02-08T16:14:35.11+00:00

Hello community,

I have a Custom Vision project trained and published and im trying to use it with the Prediction API (https://learn.microsoft.com/en-us/azure/cognitive-services/custom-vision-service/use-prediction-api). I had it working before but suddenly the red line always throws a HttpRequestException and i cant figure out why. I tried using different accounts, projects and internet connections. Does anyone have an idea on what could be causing this problem?

Exception thrown: 'System.Net.Http.HttpRequestException' in mscorlib.dll
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
--- End of inner exception stack trace ---
at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
at System.Net.PooledStream.EndWrite(IAsyncResult asyncResult)
at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at CVSPredictionSample.Program.<MakePredictionRequest>d__1.MoveNext() in <path>\CustomVisionPrediction.cs:line 41

Thanks in advance!

Azure AI Custom Vision
Azure AI Custom Vision
An Azure artificial intelligence service and end-to-end platform for applying computer vision to specific domains.
209 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,204 questions
{count} votes