A
A
Ark Tarusov2020-08-21 00:48:48
.NET
Ark Tarusov, 2020-08-21 00:48:48

External connection to local iis express?

Hello!

While I was writing this question, I tried various other ways to solve the problem, and in the end I managed to solve it.
But I'll leave the question, giving an answer to it, I'm sure I'm not the only one who could hardly find the answer and maybe it will help someone else.

Wrote a small net core 3.1 web api server.
Made a configuration for access on 6666 and 6669 port.

Configuration)

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

If I access from the same PC on which the server is via localhost:6666, then everything is fine.
If I try to access from the local network using the ip of a computer on the local network 192.168.88.6:6666, then I get the answer "Error: connect ECONNREFUSED 192.168.88.6:6666" both from the computer itself and from other devices on the network.
I get a similar response if I try to access via an external static ip.

Conducted a listing of ports 6666 port is open. Port forwarding is configured on the router and everything is fine too.

Googling on similar problems gave two points:
1. Register in the project settings instead of localhost:6666 , external ip, should then work. ( How to open access to IIS? )
2. Access is denied on the server itself - and do whatever you want.

The results for these items:
1. If you register the ip of the PC in the LAN, then the server starts, but now you can’t get access to it at all, either from the local computer, or from devices on the network, or from outside. If you write an external
then the project does not start.
5f3ed03deb2d4821669324.jpeg
However, with the ip of the local network, you can reach the server if you build it and run it as a separate application and not through the ide.

2.
  • I tried to make all the settings default and run, everything is the same on the ports issued when creating the project.
  • I asked for advice from a friend of the system administrator - maybe he messed up with forwarding, but no, he assured that the port is open, available and you can get through to it.
  • In order to be sure of the ports, I raised the servers of a couple of games and sites for which I knew exactly how to do everything on them)
  • And another thing - in fact, while I was writing this question, I tried different points, and in the end I did.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Ark Tarusov, 2020-08-21
@kreo_OL

The solution to the problem came out in three points
1. It is necessary to start the server that was brought together - from ide it does not work at all, except for localhost.
2. In my case, https is required. But I don’t know why, but it only helped to register both ports

.UseStartup<Startup>().UseUrls("http://192.168.88.6:6666", "https://192.168.88.6:6669");

If you communicate on 6666, then it comes that you need to go to 6669. But if you register only one port in UseUrls, then the same "Error: connect ECONNREFUSED 192.168.88.6:6666" (or 6669) comes.
3. The first two points helped to see the server on the local network. and only the inclusion of the iss service in the Windows components gave access from outside
spoiler
5f3ef0fd41527473603034.png

By the way, if you do not do step 2, and do the third one, then absolutely nothing works on any port.)
I hope those who know will come here and tell you why everything is so.
spoiler
If the confusion of ports in the question and answer is embarrassing, then this is due to the fact that I used a scientific poke in despair.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question