locked
Get file via IFileProvider from systemctl (Ubuntu 20) RRS feed

  • Question

  • User-1035552022 posted

    Why can't IFileProvider get files located in wwwroot when the application is running under systemctl?

      var localpath = _fileProvider.GetDirectoryContents(@"/wwwroot");
                foreach (var item in localpath)
                {
                    _logger.LogInformation($@"localpath:{ item.PhysicalPath}");


    if the application is run as dotnet <appName>.dll then the files are found

    Sunday, August 2, 2020 12:56 PM

All replies

  • User-474980206 posted

    You probably did not set the working folder in the  systemctl exec script

    Sunday, August 2, 2020 4:01 PM
  • User-1035552022 posted

    but i set the WorkingDirectory

    [Unit]
    Description=Terminal App
    After=network.target 
    [Service]
    ExecStart=/usr/bin/dotnet /opt/TerminalView/TerminalView.dll
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=terminal-app
    Restart=on-failure
    RestartSec=5s
    User=terminal
    WorkingDirectory=/opt/TerminalView
    [Install]
    WantedBy=multi-user.target
    

    Sunday, August 2, 2020 9:36 PM