起動スクリプトを使用して「dotnet run」を実行すると、「未処理の例外:System.ArgumentNullException:値はnullにできません」エラー

起動スクリプトを使用して「dotnet run」を実行すると、「未処理の例外:System.ArgumentNullException:値はnullにできません」エラー

dotnet run --configuration Releaseシステムサーバーの起動/再起動時に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エラーなしでうまく機能します。

誰でもこの問題を解決するのに役立ちますか?

ベストアンサー1

おすすめ記事