title: Dotnet app started as daemon doesn't working properly
body: <p>I developed a simple application using <code>NetCore</code>, the app write the content on a file every time is executed, this is the code:</p>
  <pre><code>using System;
  using System.IO;
  
  namespace SimpleApp
  {
     class Program
     {
         static void Main(string[] args)
         {
            using (StreamWriter writer = new StreamWriter(&quot;log.txt&quot;, true))
            {
                writer.WriteLine(&quot;Hello World&quot;);
            }
         }
     }
  }
  </code></pre>
  <p>so if I start the application in this way: <code>dotnet SimpleApp.dll</code> I get a <code>log.txt</code> file with <code>Hello World</code> in it.</p>
  <p>Now, I'm trying to create a linux daemon, I have no experience in that, so I wrote what I learned on Internet, I created a service cakked <code>console.service</code> which contains this structure:</p>
  <pre><code>[Unit]
  Description = Hello World Daemon
  
  [Service]
  ExecStart = /usr/bin/dotnet /home/my username/Desktop/publish/SimpleApp.dll
  Restart = on-failure
  
  [Install]
  WantedBy = multi-user.target
  </code></pre>
  <p>So essentially I have a description, and I setted in <code>ExecStart</code> the path of my <code>dotnet</code> installation and the path of the application.</p>
  <p>Later I have an <code>Install</code> that if understood well tell to the <code>systemctl</code> that the service can run for each user, right?</p>
  <p>Later, I copied the service in the <code>system</code> folder:</p>
  <pre><code>sudo cp console.service /lib/systemd/system
  </code></pre>
  <p>and I enabled it:</p>
  <pre><code>sudo systemctl daemon-reload 
  sudo systemctl enable console.service
  </code></pre>
  <p>so, I executed the service:</p>
  <pre><code>sudo systemctl start console.service
  </code></pre>
  <p>and when I print the status:</p>
  <pre><code>systemctl status console.service
  </code></pre>
  <p>will is displayed this:</p>
  <p><a href="https://i.stack.imgur.com/nucWD.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nucWD.jpg" alt="enter image description here" /></a></p>
  <p>the problem's that inside the folder <code>publish</code> (the path of the application specified in ExecStart) I doesn't have any log.txt at this time.</p>
  <p>Why?</p>