0

I have an API written in ASP.NET and when I run it with IIS express, it opens up to the following page https://localhost:44381/api/strs. This works completely fine. However, when I try to access it from another computer or even my local computer using my LAN address, https://10.0.0.185:44381/api/strs, I get the error message HTTP Error 400. The request hostname is invalid.

EDIT - I realized I forgot to add that accessing from http://10.0.0.185:19093/ also gives the same error

These are my bindings

                <bindings>
                    <binding protocol="https" bindingInformation="*:44381:10.0.0.185" />
                </bindings>

and here is my launchsettings.json

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:19093",
      "sslPort": 44381
    }
  },
  "$schema": "http://json.schemastore.org/launchsettings.json",
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "api/strs",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "TestApi2": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "api/strs",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "https://localhost:5001;http://localhost:5000"
    }
  }
}

I have been trying to solve this problem for hours but no matter what I do I just get status code 400 or "network connection reset". Any help is appreciated.

salt
  • 83
  • 1
  • 8
  • Maybe this answear could help you. https://stackoverflow.com/a/39733403/11137121 – Gabriel Gonçalves Nov 22 '21 at 03:39
  • unfortunately not, I still get the same error 400. I think I might just have to give up this project for now because I've been trying to fix this for 6 or 7 hours and I haven't made any progress – salt Nov 22 '21 at 04:33
  • I would suggest using our free extension, Conveyor which solves this problem https://marketplace.visualstudio.com/items?itemName=vs-publisher-1448185.ConveyorbyKeyoti without requiring binding editings. – Jim W Feb 03 '22 at 19:06

1 Answers1

0

Use this link to configure and deploy an application with IIS on windows,

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 22 '21 at 10:04