我正在尝试使用dotnet run --configuration Release系统服务器Startup/Reboot 运行一个dotnet应用程序.我正在使用init.d脚本来实现同样的目标.
我的启动脚本位于/etc/init.d/myscript包含以下内容:
#!/bin/sh
/home/user/myscripts/botScript.sh
内容botScript.sh:
#!/bin/bash
cd /home/user/bot/
nohup dotnet run --configuration Release &
当我的服务器启动或重新启动时,启动脚本会被执行但dotnet run不起作用.我收到以下错误:
Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: path1
at System.IO.Path.Combine(String path1, String path2, String path3)
at Microsoft.DotNet.ProjectModel.Resolution.PackageDependencyProvider.ResolvePackagesPath(String rootDirectory, GlobalSettings settings)
at Microsoft.DotNet.Configurer.NuGetCacheSentinel.get_NuGetCachePath()
at Microsoft.DotNet.Configurer.NuGetCacheSentinel.Exists()
at Microsoft.DotNet.Configurer.DotnetFirstTimeUseConfigurer.ShouldPrimeNugetCache()
at Microsoft.DotNet.Configurer.DotnetFirstTimeUseConfigurer.Configure()
at Microsoft.DotNet.Cli.Program.ConfigureDotNetForFirstTimeUse(INuGetCacheSentinel nugetCacheSentinel)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
at Microsoft.DotNet.Cli.Program.Main(String[] args)
但是所有其他命令在该脚本中工作正常,甚至只是运行也dotnet很好(我已经检查过).这只是dotnet run不起作用.
是的,但是当我运行脚本时,myscript以及botScript.sh在登录到我的服务器之后,它都可以正常工作而没有任何错误.
拜托,任何人都可以帮我解决这个问题吗?