I was testing a simple api in combination with the dart client in flutter.
I run my server locally on the same machine where the ios and android emulators are running.
The ios emulator has no issues; the android emulator has issues. A simple call is working, but from the moment I do some extra stuff in my api, there are timeout errors. Please note that the deployed version is working fine. So it’s a combination of using the http://10.0.2.2:5000 (to be used as localhost).
So the post
call executes fine, I also see in my logs that he has “responded” but then nothing happens; after a while I see following in flutter output:
E/flutter ( 1689): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Instance of 'WebServiceException'
E/flutter ( 1689): #0 JsonServiceClient.handleError (package:servicestack/client.dart:544:5)
E/flutter ( 1689): <asynchronous suspension>
E/flutter ( 1689): #1 JsonServiceClient.sendRequest (package:servicestack/client.dart:318:20)
E/flutter ( 1689): <asynchronous suspension>
E/flutter ( 1689): #2 JsonServiceClient.send (package:servicestack/client.dart:245:12)
E/flutter ( 1689): #3 JsonServiceClient.post (package:servicestack/client.dart:110:12)
E/flutter ( 1689): #4 main (package:scoryo/main.dart:21:39)
E/flutter ( 1689): <asynchronous suspension>
E/flutter ( 1689): #5 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:189:25)
E/flutter ( 1689): #6 _rootRun (dart:async/zone.dart:1124:13)
E/flutter ( 1689): #7 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter ( 1689): #8 _runZoned (dart:async/zone.dart:1516:10)
E/flutter ( 1689): #9 runZoned (dart:async/zone.dart:1500:12)
E/flutter ( 1689): #10 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:180:5)
E/flutter ( 1689): #11 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:300:19)
E/flutter ( 1689): #12 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
E/flutter ( 1689):
and at the same time this in my net core output:
[16:11:05 ERR] ServiceBase<TRequest>::Service Exception
System.Net.Http.HttpRequestException: Operation timed out ---> System.Net.Sockets.SocketException: Operation timed out
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at System.Net.HttpWebRequest.SendRequest()
at System.Net.HttpWebRequest.GetResponse()
Any idea?