About .net Core notes

1..net core site to find bin directory on the deployment of the background layer to open cmd enter the command: dotnet publish -c release -r win7-x64 (release version) dotnet publish -c debug -r win7-x64 (debug version)

2..net core hosting services in Windows PowerShell with administrator permissions to open enter the command:

$acl = Get-Acl "{EXE PATH}"
$aclRuleArgs = {DOMAIN OR COMPUTER NAME\USER}, "Read,Write,ReadAndExecute", "ContainerInherit,ObjectInherit", "None", "Allow"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($aclRuleArgs)
$acl.SetAccessRule($accessRule)
$acl | Set-Acl "{EXE PATH}"

New-Service -Name {NAME} -BinaryPathName {EXE FILE PATH} -Credential {DOMAIN OR COMPUTER NAME\USER} -Description "{DESCRIPTION}" -DisplayName "{DISPLAY NAME}" -StartupType Automatic

  • {EXE PATH} - path to the application on the host folder (such as  d:\myservice). Do not include the executable file the application in this path. Non-essential item trailing slash.
  • {DOMAIN OR COMPUTER NAME\USER} - service user account (such as  Contoso\ServiceUser).
  • {NAME} - service name (such as  MyService).
  • {EXE FILE PATH} - path to the application executable file (such as  d:\myservice\myservice.exe). Please file name and extension of the executable file included.
  • {DESCRIPTION} - Service description (such as  My sample service).
  • {DISPLAY NAME} - service display name (such as  My Service).

Reference: https://docs.microsoft.com/zh-cn/aspnet/core/host-and-deploy/windows-service?view=aspnetcore-2.1&tabs=visual-studio

Guess you like

Origin www.cnblogs.com/kacy/p/11599422.html