.Net Core 3.1 deploy on Centos 7
I solved the problem.
When we create a domain in the plesk panel, apache creates its own configuration file, so all I have to do is change the Additional apache directives settings from within Apache & nginx under the Hosting & DNS settings of the relevant domain from the plesk panel.
Plesk --> Websites & Domains --> <> --> Hosting & DNS --> Apache & nginx
Additional directives for HTTP
Header set Access-Control-Allow-Origin "http://yourdomain.com"
Header set Access-Control-Allow-Headers "Access-Control-Allow-Headers, Origin, Accept,
X-Requested-With, Content-Type, Access-Control-Request-Method, Access-ControlRequest-Headers, Authorization, Content-Disposition"
Header set Access-Control-Allow-Methods "*"
Header set Access-Control-Allow-Credentials "true"
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
Additional directives for HTTPS
Header set Access-Control-Allow-Origin "https://yourdomain.com"
Header set Access-Control-Allow-Headers "Access-Control-Allow-Headers, Origin, Accept,
X-Requested-With, Content-Type, Access-Control-Request-Method, Access-ControlRequest-Headers, Authorization, Content-Disposition"
Header set Access-Control-Allow-Methods "*"
Header set Access-Control-Allow-Credentials "true"
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
If you have a cors problem, you can add lines starting with header set.
After doing all these, your application will run if it is ready in your service file.
How to run a .NET Core console application on Linux
Follow the below steps to run your application:
Publish your application as a self contained application:
dotnet publish -c release -r ubuntu.16.04-x64 --self-contained
Copy the
publish
folder to the Ubuntu machineOpen the Ubuntu machine terminal (CLI) and go to the project directory
Provide execute permissions:
chmod 777 ./appname
Execute the application
./appname
How to compile .NET Core app for Linux on a Windows machine
Using dotnet build command, you may specify --runtime
flag
-r|--runtime < RUNTIME_IDENTIFIER >
Target runtime to build for. For a list of Runtime Identifiers (RIDs) you can use, see the RID catalog.
RIDs that represent concrete operating systems usually follow this pattern [os].[version]-[arch]
Fo example, to build a project and its dependencies for Ubuntu 16.04 runtime use:
dotnet build --runtime ubuntu.16.04-x64
.NET Core 3.1 Kestrel/Apache stop responding requests
My problem was was simpler than I thought, just had to increase the MaxRequestWorkers
in /etc/apache2/mods-available/mpm_event.conf
, as SignalR mainly uses WebSocket connections which keeps a request worker busy as long as it is connected.
Another possible solution was to change the HttpTransportType
in the client and force another type, as ServerSentEvents
for example, but it has other counterparts.
Related Topics
Problem of Understanding Clock_Gettime
Nvcc Cuda Cross Compiling Cannot Find "-Lcudart"
How to Remove Everything Else in a Folder Except Filea
Capture Output of a Bash Command, Parse It and Store into Different Bash Variables
Simulate Microphone (Virtual Mic)
Detecting If The Monitor Is Powered Off
How to Install a Recent Version of Gdal on Amazon Linux
Linux Shell Scripting: Hex Number to Binary String
Where M Flag and O Flag Will Be Stored in Linux
Docker - Eacces: Permission Denied, Mkdir '/App/Node_Modules/.Cache'
How Do Parent and Child Share Pages After Fork() with Copy-On-Write in Linux
Linux Process Context and Svc Call in Arm
Command Line Video Editing Tools
Bluetooth Low-Energy on Linux API
How to Use 9-Bit Serial Communication in Linux
Library Path Order for Alternate Glibc Dynamic Linker (Ld.So)