zoukankan      html  css  js  c++  java
  • netcorec程序部署配置

    IIS方式:

    1:iis配置netcore发布的文件

    2:iis设置运行库无托管模式

    3:安装DotNetCore.1.0.4_1.1.1-WindowsHosting.exe

    4:安装dotnet-hosting-2.2.2-win.exe

    https://dotnet.microsoft.com/download

    5:OK

    windows服务方式:

     1:main函数入口修改位如下(安装包文件:Microsoft.AspNetCore.Hosting.WindowsServices):

    #region
                IWebHost host = WebHost.CreateDefaultBuilder(args)
            .UseKestrel(options => { options.Listen(IPAddress.Any, 5201); }) //5201是我用的端口,你改成自己的
            .UseStartup<Startup>() //使用Startup配置类
            .Build();
                bool isService = !(Debugger.IsAttached || args.Contains("--console")); //Debug状态或者程序参数中带有--console都表示普通运行方式而不是Windows服务运行方式
                if (isService)
                {
                    host.RunAsService();
                }
                else
                {
                    host.Run();
                }
                #endregion

    2:配置服务

    以管理员身份运行命令行工具,输入如下:

    创建服务
    sc create MyServiceName binPath= ""C:program filesdotnetdotnet.exe" "D:ServicesMyService.dll(程序发布包里的主文件地址)"" DisplayName= "MyServiceName" start= auto
    启动服务
    sc run MyServiceName

    停止服务
    sc stop MyServiceName

    卸载服务
    sc delete MyServiceName
  • 相关阅读:
    [luogu p1996] 约瑟夫问题
    [luogu p1098] 字符串的展开
    [luogu p1035] 级数求和
    [luogu p1004] 方格取数
    [luogu p3383]【模板】线性筛素数
    [luogu p1223] 排队接水
    [luogu p1002] 过河卒
    [luogu p1001] A+B Problem
    Java BIO/NIO(Non-blocking I/O)详解
    Linux页框&伙伴算法以及slab机制
  • 原文地址:https://www.cnblogs.com/mrray/p/10734278.html
Copyright © 2011-2022 走看看