Why dotnet core for Linux does not accept more than one service running at the same time in Apache

I’m trying to put two services running on apache for ubuntu at the same time, both works, but only one works at a time.

Apache configuration:

<VirtualHost *:80>      ServerName webapp1.org    ServerAlias *.webapp1.org    ProxyPreserveHost On      ProxyPass / http://127.0.0.1:5000/      ProxyPassReverse / http://127.0.0.1:5000/      RewriteEngine on      RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]      RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]      RewriteRule /(.*) ws://127.0.0.1:5000/$1 [P]      ErrorLog /var/log/apache2/netcore-error.log      CustomLog /var/log/apache2/netcore-access.log common   </VirtualHost>  <VirtualHost *:80>    ServerName webapp2.org    ServerAlias *.webapp2.org    ProxyPreserveHost On    ProxyPass / http://127.0.0.1:5001/    ProxyPassReverse / http://127.0.0.1:5001/    RewriteEngine on      RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]      RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]      RewriteRule /(.*) ws://127.0.0.1:5001/$1 [P]      ErrorLog /var/log/apache2/netcore-error.log      CustomLog /var/log/apache2/netcore-access.log common   </VirtualHost> 

And below each service:

[Unit]   Description=ASP .NET Web Application   [Service]   WorkingDirectory=/var/netcore/netcoreapp3.1 ExecStart=/usr/bin/dotnet /var/netcore/netcoreapp3.1/FooBarMvc.dll  Restart=always   RestartSec=10   SyslogIdentifier=netcore-mvc   User=www-data   Environment=ASPNETCORE_ENVIRONMENT=Production   [Install]   WantedBy=multi-user.target  [Unit] Description=ASP .NET WebAPI Application [Service] WorkingDirectory=/var/netcore/netcoreapp3.1/webapi ExecStart=/usr/bin/dotnet /var/netcore/netcoreapp3.1/webapi/FooBarWebApi.dll Restart=always RestartSec=10 SyslogIdentifier=netcore-webapi User=www-data Environment=ASPNETCORE_ENVIRONMENT=Production [Install] WantedBy=multi-user.target 

According to Microsoft documentation, the second service should respond on port 5001, but it doesn’t.

How to make both services run at the same time?

Should I actually put two services running on Linux, or would just one be enough?

Thanks

PS: I tried this reference, but it didn’t work.

Host multiple asp.net core web application under a single linux server

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.