DotNet unter Linux

7/1/2022 10:22:21 PM by Chris 1138
--> https://www.roundthecode.com/dotnet/asp-net-core-web-hosting/how-to-install-an-asp-net-core-in-net-5-app-on-ubuntu-20-04 https://www.how2shout.com/linux/3-ways-to-install-net-6-dotnet-on-ubuntu-20-04-lts-focal-fossa/ ``` Bash wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb dpkg -i packages-microsoft-prod.deb aptitude update aptitude install -y apt-transport-https && aspnetcore-runtime-5.0 aptitude install Apache2 a2enmod rewrite && a2enmod proxy && a2enmod proxy_http && a2enmod headers && a2enmod ssl nano /etc/apache2/sites-enabled/dotNet5.conf ``` ``` <VirtualHost *:*> RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME} </VirtualHost> <VirtualHost cschmidt.eu:80> ProxyPreserveHost On ProxyPass / http://127.0.0.1:5000/ ProxyPassReverse / http://127.0.0.1:5000/ ServerName cschmidt.eu ServerAlias cschmidt.eu ErrorLog ${APACHE_LOG_DIR}api-error.log CustomLog ${APACHE_LOG_DIR}api-access.log common </VirtualHost> ``` asp-net core web app erstellen und per ftp in /var/www/cschmidt-cms publishen ``` Bash nano /etc/systemd/system/cschmidt-cms.service ``` ``` [Unit] Description=cschmidt-cms [Service] WorkingDirectory=/var/www/cschmidt-cms/ ExecStart=/usr/bin/dotnet /var/www/cschmidt-cms/cschmidt-cms.dll Restart=always # Restart service after 10 seconds if the dotnet service crashes: RestartSec=10 KillSignal=SIGINT SyslogIdentifier=cschmidt-cms User=www-data Environment=ASPNETCORE_ENVIRONMENT=Production [Install] WantedBy=multi-user.target ``` ``` Bash systemctl enable cschmidt-cms.service systemctl start cschmidt-cms.service systemctl status cschmidt-cms.service <-- sollte active stehen ``` dann webseite aufrufen https://www.talkingdotnet.com/asp-net-core-5-for-enabling-razor-runtime-compilation/ https://blog.jetbrains.com/dotnet/2020/11/25/getting-started-with-entity-framework-core-5/ ``` C# dotnet ef migrations add InitialCreate --project CSchmidt-CMS.Database --startup-project CSchmidt-CMS.WebApp dotnet ef database update --project CSchmidt-CMS.Database --startup-project CSchmidt-CMS.WebApp dotnet tool install -g dotnet-aspnet-codegenerator ```


About author

Chris

Moin, hier sollte ein Text über mich stehen, ggf reiche ich den noch nach, ggf nicht. Manchmal ist es doch auch ganz schön keine Infos über einen Author zu haben :-)


Scroll to Top