Reputation: 949
I Have a project in ASP.NET 5 using self-host.
PROJECT.JSON
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000",
"gen": "Microsoft.Framework.CodeGeneration",
"ef": "EntityFramework.Commands"
},
It using the http://localhost:5000...
I want to know how can i acess the website from another PC, not using localhost. Like a IP with or without DNS.
Please, help me!
Upvotes: 3
Views: 1399
Reputation: 11964
You should allow incoming connections for your application:
First, start an administrative command prompt. Second, run these commands, replacing yourip:yourport with whatever IP and port you are using:
netsh http add urlacl url=http://yourip:yourport/ user=everyone
This just tells http.sys that it’s ok to talk to this url.
Upvotes: 1
Reputation: 1048
The answer to this question can be found here https://github.com/aspnet/Home/issues/799
Change server.urls=http://localhost:5000 to server.urls=http://*:5000, but if you do that you'll need to run the process (or VS) as admin.
Upvotes: 1
Reputation: 352
I was having the same issue trying to self host and only being able to access locally. I checked with Angry IP Scanner and saw that the port wasn't even open when the app was running so obviously that would prevent remote access.
Eventually I realised the --server.urls
command must basically work like bindings in IIS, so where you have --server.urls http://localhost:5000
, you just need to change localhost
for your computer name or ip address (or add both) e.g. --server.urls http://mypc:5000
.
This worked for me so I hope it does for you!
Upvotes: 1
Reputation: 1761
Note that, you can access the machine only if the other machine is also in the same LAN network. Just use "ping " to quickly see if both the machines are in the same network.
Upvotes: 0