0

I am having a problem with the working of the api. Installing the api to iis executes "405". However, when running on localhost, it returns 200. I couldn't understand what should I do? I am using postman for testing here is postman enter image description here

It works when I try it on localhost

enter image description here

flutter codes

  void TraSil() async {
    try {
      String uri = 'http://192.168.0.21/api/values/DegerSil/S00001/';
      Uri ur = Uri.parse(uri);
      final response =
          await http.delete(ur).timeout(const Duration(seconds: 30));
      if (response.statusCode == 200) {
        print("Deleted");
      } else {
        throw response.reasonPhrase.toString();
      }
    } catch (e) {
      _showMyDialog("Hata", e.toString());
    }
  }

I couldn't figure out where the problem came from. Do I need to give permission from somewhere? can you help?

1 Answers1

0

If you can replicate problem using external software like Postman it is probably IIS configuration problem, not related to Flutter http client. So, you should check your IIS configuration first, make it working on Postman, then requesting via Flutter client should work with no problems.

As I can see, you use https for localhost and http for 192.168.0.21. Some servers may handle different protocols in different way. You may try to request 192.168.0.21 with https.

Please check:

https://learn.microsoft.com/en-us/troubleshoot/developer/webapps/iis/health-diagnostic-performance/http-error-405-website

"405 method not allowed" in IIS7.5 for "PUT" method