Skip to content

CoExp ASP.NET Core MVC configuration

Sonia García-Ruiz edited this page Jan 5, 2021 · 1 revision

Previous:

CoExp .NET Core MVC configuration

Now, let's configure the set of ASP.NET Core libraries of CoExp Web Application.

As you may have supposed, the first step consists of downloading the CoExp Web Application repository from GitHub. In this example, we are going to download it within a folder called 'CoExp':

$ cd CoExp/
$ git clone https://github.com/SoniaRuiz/CoExp_Web.git

Next, we build the solution (this step is essential to generate all libraries):

$ cd ./CoExp_Web/
$ dotnet publish -f netcoreapp2.1 -c Release

If everything has gone as expected, we should have all ASP.NET Core libraries generated and ready to be served on a web server. However, ASP.NET Core framework natively uses a Kestrel server, therefore, we first need to create a Kestrel service able to find our CoExp libraries and serve them. We can approach this step by typing the commands below:

$ nano /etc/systemd/system/kestrel-example.service
[Unit]
Description=CoExpWeb.NET Core Web page running on CentOS 7

[Service]
WorkingDirectory=/my_path_to_CoExp_folder/CoExp_Web/bin/Release/netcoreapp2.1/publish
ExecStart=/usr/bin/dotnet /my_path_to_CoExp_folder/CoExp_Web/bin/Release/netcoreapp2.1/publish/CoExp_Web.dll
Restart=always
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnet-coexpweb
User=root
Environment=ASPNETCORE_ENVIRONMENT=Production

[Install]
WantedBy=multi-user.target

Finally, we enable the KESTREL service and start it:

$ systemctl enable kestrel-example.service
$ systemctl start kestrel-example.service

That's all!

Next:

Clone this wiki locally