4
Hello, in an ASP.NET MVC web project I am trying to consume an API that is a Web API project, the two applications are running on the same server.
When I access the MVC application error occurs when this application tries to consume the Web API, the following error occurs:
Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente 127.0.0.1:24777
[SocketException (0x274d): Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente 127.0.0.1:24777]
System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) +6641121
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) +271
[WebException: Impossível conectar-se ao servidor remoto]
System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context) +2263386
System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar) +106
[HttpRequestException: An error occurred while sending the request.]
Can it now be timeout of the Web API action?
Being a Socketexception, it seems to me to be a problem of connection to that address/port (127.0.0.1:24777). Have you tested to see if the service is in the air and can it even be accessed from this door? Try to consume some of the services using Postman (www.getpostman.com)? The result there can help us better understand the problem.
– Jean Mallet
It no longer had this address in the application, but at the time of posting for some reason the files were not overwritten, so I deleted all the files and pasted again and stopped this error, but now this error is occurring: A task has been canceled. Description: An untreated exception occurred during the execution of the current web request. Examine stack tracking for more information about the error and where it originated in the code. Exception Details: System.Threading.Tasks.Taskcanceledexception: A task has been cancelled
– Edmar Munhoz
Can it now be timeout of the Web API action?
– Edmar Munhoz