How to enable ASP.Net core stdout error logs?

Are you facing An error occurred while starting the application, start-up frailer in ASP.NET core? You need to check the error logs file to trace out the exact issue. KLCWEB study deeply into .NET core application’s error to provide the best solution.

1.) find our your site root folder from your hosting space.

2.) open web.config file > find aspnetCore > stdout and make it true as mention the below.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\DotNetCoreApp.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
</configuration>

Once you have done this, you need to restart your application pool and refresh your site, The error log file will be generated inside logs folder which is located inside your site root folder, make sure you have created a logs folder before generating logs.

Tagged :

How to install .net core in Linux?

As we all know .NET core is cross-platform but it would be hard to publish a .NET core project on Linux OS. Do not worry, KLCWEB has a solution and guides to install .net core to Linux OS. Let’s install.net core in Linux OS.

1.) Install required component

  • sudo apt-get update
  • sudo apt-get install apt-transport-https
  • sudo apt-get update
  • sudo apt-get install dotnet-sdk-3.1
  • sudo apt-get install dotnet-runtime-3.1
  • sudo apt-get install aspnetcore-runtime-3.1

2.) Configure Apache server

Once You did install all the .NET core required components for Linux then, configure the Apache server to run the .NET core on Linux OS.

  • sudo apt-get install apache2
  • sudo a2enmod proxy proxy_http proxy_html proxy_wstunnel
  • sudo a2enmod rewrite
Now, you need to make configuration file for proxy on Apache

> sudo nano /etc/apache2/conf-enabled/netcore.conf

  1. VirtualHost *:80>  
  2.    ServerName www.DOMAIN.COM  
  3.    ProxyPreserveHost On  
  4.    ProxyPass / http://127.0.0.1:5000/  
  5.    ProxyPassReverse / http://127.0.0.1:5000/  
  6.    RewriteEngine on  
  7.    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]  
  8.    RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]  
  9.    RewriteRule /(.*) ws://127.0.0.1:5000/$1 [P]  
  10.    ErrorLog /var/log/apache2/netcore-error.log  
  11.    CustomLog /var/log/apache2/netcore-access.log common  
  12. </VirtualHost>  

Paste this code to config file of Apache server, ensure that you will replace www.domain.com > your real domain name.

3.) Restart Apache server

  • sudo service apache2 restart
  • sudo apachectl configtest

4.) Start .NET service.

You need to move your all projects files to specific path using the below command.

sudo cp -a ~/release/ /var/netcore/

> Now, Create a service file for you .NET core project.

sudo nano /etc/systemd/system/ServiceFile.service

Now, restart your server using the below code.
  • sudo systemctl enable {Service Name}
  • sudo systemctl start {Service Name}
Tagged :