Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.net 5 Self-Hosted on Live Windows Server - EACCES permission denied?

I was under the impression that we could actually run a console app on a live server that would listen and serve data (web pages if it were for that purpose). This way, we won't have to host our web apps on IIS. I always thought that this is what "hosting web apps in your own process" means.

Here is a part of my project.json that I think is relevant:

  "dependencies": {
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5010"
  },

If I went to the command prompt, dir to the root of the project, and then ran dnx web, yes, indeed, the console app is running and I could go to my browser and type http://localhost:5010 and see the website.

But when I change that url to an actual url (and yes, I already have DNS pointing to my server for that url), I'll get the error EACCES permission denied.

If we can "self-host" but only with localhost, that seems only good for local development. Why have the ability to "self-host in my own process" if it can't be for live/production?

What would I need to do? Will I need to set some permissions to a particular folder? Which user/group, which permissions, and which folder? I tried IIS_IUSRS on the root of the project, and of course, that doesn't work because I wanted to bypass IIS anyway.

Any help would be greatly appreciated.

like image 857
Mickael Caruso Avatar asked Dec 17 '15 21:12

Mickael Caruso


1 Answers

For anyone finding this question later:

When you start the Kestrel server, you need to ensure that there isn't already something listening on that port, otherwise it won't be able to start. IIS is an obvious culprit if you're trying to host something on standard http (port 80). You either need to stop whatever else is running on that port, or use it to forward the traffic onto your Kestrel server.

More information on hosting ASP.NET 5 projects directly in IIS can be found here: https://docs.asp.net/en/latest/publishing/iis.html

like image 81
adrian Avatar answered Sep 23 '22 18:09

adrian