首页 新闻 会员 周边

asp.net core mvc 站点 在Centos 7.2 下怎么设置开机启动

0
悬赏园豆:10 [已解决问题] 解决于 2016-07-09 11:29

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}

 

高手帮忙看看

痛快的主页 痛快 | 初学一级 | 园豆:71
提问于:2016-07-05 15:41
< >
分享
最佳答案
0
收获园豆:10
jackccc | 小虾三级 |园豆:1341 | 2016-07-05 16:05

试了不行呀

痛快 | 园豆:71 (初学一级) | 2016-07-05 16:20
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册