2

I am developing a project with frontend flutter and backend asp.net core. Once the asp.net project is deployed to IIS I can successfully get a response. I am changing base url and running asp.net project in visual studio. Then I am getting this error.

Response = SocketException: Write failed (OS Error: Connection reset by peer, errno = 104), address = 10.0.2.2, port = 42746

I am using Dio package on flutter. This is network init code.

final baseOptions = BaseOptions(
      contentType: "application/json",
      //baseUrl: "http://192.168.1.111:80",  // IIS
      baseUrl: "http://10.0.2.2:44305",      // Local
    );

    _dio = Dio(baseOptions);
    (_dio?.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
        (HttpClient client) {
      client.badCertificateCallback =
          (X509Certificate cert, String host, int port) => true;
      return client;
    };

This is swagger view when run project on local (visual studio)

enter image description here

Mevlüt Gür
  • 155
  • 1
  • 10
  • Possible duplicate of: https://stackoverflow.com/a/55786011/10659482 – Akif Aug 12 '21 at 14:05
  • 1
    Does this answer your question? [SocketException: OS Error: Connection refused, errno = 111 in flutter using django backend](https://stackoverflow.com/questions/55785581/socketexception-os-error-connection-refused-errno-111-in-flutter-using-djan) – Carl Zhao Aug 13 '21 at 02:23
  • @Akif As you see i try to this solution on baseUrl. – Mevlüt Gür Aug 13 '21 at 06:49

0 Answers0