asp.net core mvc 站点 在Centos 7.2 下怎么设置开机启动
我设置了开机启动,但报错
如下:
#!/bin/bash # ### BEGIN INIT INFO # Provides: dotnet # Required-Start: $local_fs $network $named $remote_fs $syslog # Required-Stop: $local_fs $network $named $remote_fs $syslog # Short-Description: Very Secure Ftp Daemon # Description: dotnet is a Very Secure FTP daemon. It was written completely from # scratch ### END INIT INFO # dotnet This shell script takes care of starting and stopping # standalone dotnet. # #chkconfig: 2345 80 80 # description: dotnet is a ftp daemon, which is the program \ # that answers incoming ftp service requests. # processname: dotnet # Set up a default search path. PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin" export PATH RETVAL=0 prog="dotnet" start() { # Start daemons. # Check that networking is up. echo $"Usage: $0 {start}" cd /root/coremvc1 && dotnet run echo $"Usage: {start2}" return 1 } stop() { # Stop daemons. cd /root/coremvc1 && dotnet run return $RETVAL } # See how we were called. case "$1" in start) echo $"Usage: {start}" start ;; stop) stop ;; restart|reload) stop start RETVAL=$? ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|try-restart|force-reload|status}" exit 1 esac exit $RETVAL
启动服务时 service dotnet start 报错:
Usage: {start}
Usage: /etc/init.d/dotnet {start}
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)
/etc/init.d/dotnet: line 27: 2528 Aborted dotnet run
Usage: {start2}
高手帮忙看看