2017-10-19 37 views
1

我有一个.NET Core 2.0应用程序,我想在Linux服务器上运行。在Linux上使用监督器的.NET Core 2.0应用程序无法运行,因为ArgumentNullException

一切都设置正确,如果我手动运行dotnet MyApplication.dll然后应用程序启动,并在浏览器中的网址工作正常。

我想用supervisor自动启动应用程序,因为我已经看到其他人在线。

Supervisor安装并配置为运行我的应用程序,但.NET应用程序无法启动,我可以在supervisor错误日志中看到错误。

System.ArgumentNullException: Value cannot be null. 
Parameter name: path1 
    at System.IO.Path.Combine(String path1, String path2) 
    at Microsoft.DotNet.Configurer.CliFallbackFolderPathCalculator.get_DotnetUserProfileFolderPath() 
    at Microsoft.DotNet.Configurer.FirstTimeUseNoticeSentinel..ctor(CliFallbackFolderPathCalculator cliFallbackFolderPathCalculator) 
    at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient) 
    at Microsoft.DotNet.Cli.Program.Main(String[] args) 

supervisor配置如下:

[program:myapplication] 
command=/usr/bin/dotnet /var/www/myapplication.mydomain/MyApplication.dll 
directory=/var/www/myapplication.mydomain 
autostart=true 
autorestart=true 
stderr_logfile=/var/log/websites/myapplication.mydomain.err.log 
stdout_logfile=/var/log/websites/myapplication.mydomain.out.log 
environment=ASPNETCORE_ENVIRONMENT=Production 
user=myuser 
stopsignal=INT 

dotnet --info如下:

.NET Command Line Tools (2.0.0) 

Product Information: 
Version:   2.0.0 
Commit SHA-1 hash: cdcd1928c9 

Runtime Environment: 
OS Name:  ubuntu 
OS Version: 16.04 
OS Platform: Linux 
RID:   ubuntu.16.04-x64 
Base Path: /usr/share/dotnet/sdk/2.0.0/ 

Microsoft .NET Core Shared Framework Host 

    Version : 2.0.0 
    Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d 

很想得到这个工作!

还张贴在GitHub上here这个问题

回答

1

发现,此修复了设置管理员配置如下:

command=/usr/bin/dotnet MyApplication.dll 
directory=/var/www/myapplication.mydomain 

我猜是因为目录设置当前工作目录dll的路径是错误的

+1

这也会发生,如果命令中的dll文件名也是错误的,就像Iv'e刚刚发现的那样:-) – shawty

相关问题