Apache is just reverse proving to the running asp.net application. Apache does not start the asp.net core application. Typically you’d run it as a daemon. The launch setting are only used by visual studio to start the .net application.
how are you starting the asp.net core application, and configuring the ports it listens on?
Here's something to try, no promises if it will work.
run this at a command prompt:
setsebool -P httpd_can_network_connect 1
SELinux settings sometimes prevent making network connections. It's doing it's job, but can be annoying because the first time I discovered it I was chasing all of the obvious things in my application, Nginx, firewall etc.
I don't have SELinux, so I suppose this isn't the culprit. I'm not a Linux expert though, but I'd prefer not to install new packages if I don't need them (yet?).
So it now runs on 33138 port, to which Apache is supposed to direct to if I go to
https://localhost:33138. Now the problem is that I get a "500 Internal Server Error".
It isn't just for SELinux, that's what hung me up also. Some hosts install it on Ubuntu as well. Most of the time Ubuntu uses Apparmor, but sometimes I've seen the SELinux module installed.
If Apparmor is blocking it, you should see that in /var/log/syslog.
I tried using lynx to localhost:33138 and it loads website content correctly, it only responds with 500 error if I lynx
http://localhost/panel. Outside of the server if I connect directly to the port, my connection is refused. Could it be that Kestrel doesn't allow remote connections for some reason?
As for logging, I fail to understand how to enable logging. I configured my daemon for Development environment, but /logs is empty.
Unfortunately, SELinux settings are not what causes this. This command replied that SELinux is disabled, and so didn't do anything.
None
0 Points
11 Posts
Issues with new installation on Ubuntu, 503 Service Unavailable
Dec 13, 2019 01:44 PM|xtul|LINK
I have a stock, nearly unmodified Visual Studio template ASP.NET Core application I am struggling to run on Ubuntu 18.04. I've followed this guide: https://docs.microsoft.com/en-gb/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-3.1.
After a while of hitting and missing I managed to make ASP.NET service run. However when I visit my page I'm seeing a 503 Service Unavailable error.
My Apache config:
This is the result of
systemctl status tpanel
(my ASP daemon):launchSettings.json
:But like I said, when I go to
example.com/panel
I see 503 error. Other parts of my website work well.Other info:
33138
or5001
, both on apache and application, it doesn't change anything</div> </div>
All-Star
58474 Points
15793 Posts
Re: Issues with new installation on Ubuntu, 503 Service Unavailable
Dec 14, 2019 11:44 PM|bruce (sqlwork.com)|LINK
Apache is just reverse proving to the running asp.net application. Apache does not start the asp.net core application. Typically you’d run it as a daemon. The launch setting are only used by visual studio to start the .net application.
how are you starting the asp.net core application, and configuring the ports it listens on?
Member
40 Points
3 Posts
Re: Issues with new installation on Ubuntu, 503 Service Unavailable
Dec 15, 2019 10:36 PM|JeremyMorgan|LINK
Here's something to try, no promises if it will work.
run this at a command prompt:
setsebool -P httpd_can_network_connect 1
SELinux settings sometimes prevent making network connections. It's doing it's job, but can be annoying because the first time I discovered it I was chasing all of the obvious things in my application, Nginx, firewall etc.
Let me know if it works!
None
0 Points
11 Posts
Re: Issues with new installation on Ubuntu, 503 Service Unavailable
Dec 16, 2019 11:41 AM|xtul|LINK
I don't have SELinux, so I suppose this isn't the culprit. I'm not a Linux expert though, but I'd prefer not to install new packages if I don't need them (yet?).
None
0 Points
11 Posts
Re: Issues with new installation on Ubuntu, 503 Service Unavailable
Dec 16, 2019 11:44 AM|xtul|LINK
I just realized that I'm supposed to change settings using appsettings.json, for example. So this is what I currently have in appsettings.json:
So it now runs on 33138 port, to which Apache is supposed to direct to if I go to https://localhost:33138. Now the problem is that I get a "500 Internal Server Error".
Member
40 Points
3 Posts
Re: Issues with new installation on Ubuntu, 503 Service Unavailable
Dec 16, 2019 04:31 PM|JeremyMorgan|LINK
It isn't just for SELinux, that's what hung me up also. Some hosts install it on Ubuntu as well. Most of the time Ubuntu uses Apparmor, but sometimes I've seen the SELinux module installed.
If Apparmor is blocking it, you should see that in /var/log/syslog.
All-Star
58474 Points
15793 Posts
Re: Issues with new installation on Ubuntu, 503 Service Unavailable
Dec 16, 2019 06:08 PM|bruce (sqlwork.com)|LINK
on the linux server you should be able to access
https://localhost:33138/
directly using curl or browser if one is installed. you also need to add logging so you can debug these errors.
None
0 Points
11 Posts
Re: Issues with new installation on Ubuntu, 503 Service Unavailable
Dec 17, 2019 09:18 AM|xtul|LINK
I tried using lynx to localhost:33138 and it loads website content correctly, it only responds with 500 error if I lynx http://localhost/panel. Outside of the server if I connect directly to the port, my connection is refused. Could it be that Kestrel doesn't allow remote connections for some reason?
As for logging, I fail to understand how to enable logging. I configured my daemon for Development environment, but /logs is empty.
Unfortunately, SELinux settings are not what causes this. This command replied that SELinux is disabled, and so didn't do anything.
None
0 Points
11 Posts
Re: Issues with new installation on Ubuntu, 503 Service Unavailable
Dec 18, 2019 08:46 AM|xtul|LINK
Okay, I'm stupid. I realized that I made Kestrel only listen on localhost. Replacing localhost with * fixed it.
Now I just need to configure HTTPS, but I think I'll manage from here.