欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

.NET6打包部署到Windows?Service的全過程

 更新時間:2022年10月29日 08:08:59   作者:chester·chen  
net用了這么久,雖然多數(shù)都是部署在centos系統(tǒng),但也有部署在windows上的情況,下面這篇文章主要給大家介紹了關(guān)于.NET6打包部署到Windows?Service的相關(guān)資料,需要的朋友可以參考下

1.安裝Nuget包

安裝以下nuget包支持windows service

  <PackageReference Include="Microsoft.AspNetCore.Hosting.WindowsServices" Version="6.0.10" />
    <PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.1" />

2.設(shè)置ContentRootPath

不設(shè)置ContentRootPath會指向C盤sc.exe所在文件夾。

var options = new WebApplicationOptions
{
    Args = args,
    ContentRootPath = WindowsServiceHelpers.IsWindowsService() ? AppContext.BaseDirectory : default
};

var builder = WebApplication.CreateBuilder(options);

3.啟用WIndowsService

通過以下方法即可啟用WIndowsService支持

builder.Host.UseWindowsService();

4.發(fā)布項目

右鍵項目,進行發(fā)布,發(fā)布到文件夾

5.簡單安裝

通過以下BASH命令,實現(xiàn)安裝/開始/停止/刪除windows service

安裝

set "CDir=%~dp0"
sc.exe create "MyService" start=auto binpath="%CDir%MyService.exe --environment Development"

啟動

sc.exe start "MyService"

停止

sc.exe stop "MyService"

刪除

sc.exe delete "MyService"

6.安裝打包工具

安裝Inno Setup打包工具

安裝好后,進行漢語支持支持。打開Inno Setup安裝目錄,默認C:\Program Files (x86)\Inno Setup 6。

復(fù)制Default.isl,將其拷貝至C:\Program Files (x86)\Inno Setup 6\Languages文件夾,并重命名為Chinese.isl

將以下內(nèi)容覆蓋到Chinese.isl

; *** Inno Setup version 5.5.0+ Chinese messages ***
 ;
 ; To download user-contributed translations of this file, go to:
 ;   http://www.jrsoftware.org/files/istrans/
 ;
 ; Note: When translating this text, do not add periods (.) to the end of
 ; messages that didn't have them already, because on those messages Inno
 ; Setup adds the periods automatically (appending a period would result in
 ; two periods being displayed).
 
 [LangOptions]
 ; The following three entries are very important. Be sure to read and?
 ; understand the '[LangOptions] section' topic in the help file.
 LanguageName=Chinese
 LanguageID=$0409
 LanguageCodePage=0
 ; If the language you are translating to requires special font faces or
 ; sizes, uncomment any of the following entries and change them accordingly.
 ;DialogFontName=
 ;DialogFontSize=8
 ;WelcomeFontName=Verdana
 ;WelcomeFontSize=12
 ;TitleFontName=Arial
 ;TitleFontSize=29
 ;CopyrightFontName=Arial
 ;CopyrightFontSize=8
 
 [Messages]
 
 ; *** Application titles
 SetupAppTitle=安裝
 SetupWindowTitle=安裝 - %1
 UninstallAppTitle=卸載
 UninstallAppFullTitle=%1 卸載
 
 ; *** Misc. common
 InformationTitle=安裝信息
 ConfirmTitle=提示
 ErrorTitle=錯誤
 
 ; *** SetupLdr messages
 SetupLdrStartupMessage=現(xiàn)在將安裝 %1。是否繼續(xù)?
 LdrCannotCreateTemp=不能創(chuàng)建臨時文件。安裝中止!
 LdrCannotExecTemp=不能在臨時目錄中解壓文件,安裝過程中止!
 
 ; *** Startup error messages
 LastErrorMessage=%1.%n%n 錯誤 %2: %3
 SetupFileMissing=在安裝目錄中找不到文件 %1 。請更正該問題或者獲得一個新的文件。
 SetupFileCorrupt=安裝文件被占用。請獲得一個新的安裝文件。
 SetupFileCorruptOrWrongVer=安裝文件被占用, 或者安裝文件的版本不對。請更正該問題或者獲得一個新文件。
 NotOnThisPlatform=該程序不能在 %1 下運行。
 OnlyOnThisPlatform=該程序必須在 %1 下運行。
 OnlyOnTheseArchitectures=該程序只能在以下WINDOWS版本下運行:%n%n%1
 MissingWOW64APIs=該版本需要64位的安裝程序。要更正該問題,請安裝 Service Pack %1。
 WinVersionTooLowError=該軟件需要 %1 版本號 %2 或者更高。
 WinVersionTooHighError=該軟件不能在 %1 版本號 %2 或者更高版本中安裝。
 AdminPrivilegesRequired=您在安裝該程序時必須是管理員權(quán)限。
 PowerUserPrivilegesRequired=您在安裝程序是必須是管理員權(quán)限或者高權(quán)限用戶權(quán)限。
 SetupAppRunningError=安裝程序檢測到 %1 正在運行。%n%n請關(guān)閉它的所有實例。然后單擊“確認”繼續(xù)安裝,或者單擊“放棄”退出。UninstallAppRunningError=卸載程序檢測到 %1 正在運行。%n%n請關(guān)閉它的所有實例。然后單擊“確認”繼續(xù)安裝,或者單擊“放棄”退出。
 
 ; *** Misc. errors
 ErrorCreatingDir=安裝程序不能創(chuàng)建目錄 "%1"
 ErrorTooManyFilesInDir=不能在目錄"%1" 下創(chuàng)建文件。因為該目錄下有太多的文件了。
 
 ; *** Setup common messages
 ExitSetupTitle=退出安裝
 ExitSetupMessage=安裝沒有完成。 如果您現(xiàn)在退出,程序?qū)⒉槐话惭b。%n%n您可以下次在完成安裝任務(wù)。%n%n退出安裝?
 AboutSetupMenuItem=關(guān)于安裝程序[&A]...
 AboutSetupTitle=關(guān)于安裝程序
 AboutSetupMessage=%1 版本 %2%n%3%n%n%1 主頁:%n%4
 AboutSetupNote=
 TranslatorNote=
 
 ; *** Buttons
 ButtonBack=< 回退[&B]
 ButtonNext=下一步[&N] >
 ButtonInstall=安裝[&I]
 ButtonOK=確認
 ButtonCancel=放棄
 ButtonYes=市[&Y]
 ButtonYesToAll=全部確認[&A]
 ButtonNo=否[&N]
 ButtonNoToAll=全部否認[&o]
 ButtonFinish=完成[&F]
 ButtonBrowse=瀏覽[&B]...
 ButtonWizardBrowse=瀏覽[&r]...
 ButtonNewFolder=新建文件夾[&M]
 
 ; *** "Select Language" dialog messages
 SelectLanguageTitle=選擇安裝語言種類
 SelectLanguageLabel=選擇該語言作為安裝語言:
 
 ; *** Common wizard text
 ClickNext=單擊“下一步”繼續(xù),或者單擊“放棄”退出本安裝程序。
 BeveledLabel=
 BrowseDialogTitle=瀏覽文件夾
 BrowseDialogLabel=在下面的列表中選擇一個目錄, 然后單擊“確認”繼續(xù)。
 NewFolderName=新文件夾
 
 ; *** "Welcome" wizard page
 WelcomeLabel1=歡迎進入 [name] 安裝向?qū)?
 WelcomeLabel2=將在您的電腦上安裝 [name/ver] 。%n%n建議在繼續(xù)安裝之前退出其它程序的運行。
 
 ; *** "Password" wizard page
 WizardPassword=密碼
 PasswordLabel1=本安裝程序受密碼保護。
 PasswordLabel3=請輸入密碼,密碼區(qū)分大小寫。然后單擊“下一步”繼續(xù)。
 PasswordEditLabel=密碼[&P]:
 IncorrectPassword=輸入的密碼不正確,請重新輸入。
 
 ; *** "License Agreement" wizard page
 WizardLicense=用戶許可協(xié)議
 LicenseLabel=請在繼續(xù)之前仔細閱讀用戶許可協(xié)議。
 LicenseLabel3=請仔細閱讀下面的用戶許可協(xié)議。在繼續(xù)安裝之前,您必須接受該協(xié)議。
 LicenseAccepted=我接受協(xié)議[&a]。
 LicenseNotAccepted=我不接受協(xié)議[&d]
 
 ; *** "Information" wizard pages
 WizardInfoBefore=提示
 InfoBeforeLabel=在繼續(xù)安裝之前請仔細閱讀以下重要的信息。
 InfoBeforeClickLabel=當(dāng)您準(zhǔn)備好繼續(xù)安裝時,單擊“繼續(xù)”。
 WizardInfoAfter=信息
 InfoAfterLabel=在繼續(xù)安裝之前請仔細閱讀以下重要的信息。
 InfoAfterClickLabel=當(dāng)您準(zhǔn)備好繼續(xù)安裝時,單擊“繼續(xù)”。
 
 ; *** "User Information" wizard page
 WizardUserInfo=用戶信息
 UserInfoDesc=請輸入您的信息。
 UserInfoName=用戶名[&U]:
 UserInfoOrg=組織[&O]:
 UserInfoSerial=序列號[&S]:
 UserInfoNameRequired=您必須輸入一個名稱。
 
 ; *** "Select Destination Location" wizard page
 WizardSelectDir=選擇目標(biāo)位置
 SelectDirDesc=您將把[name]安裝在哪里?
 SelectDirLabel3=安裝程序?qū)裑name]安裝在下面的的文件夾中。
 SelectDirBrowseLabel=為了繼續(xù)安裝, 請單擊“下一步”。如果您想選擇一個不同的目錄,請單擊“瀏覽”。
 DiskSpaceMBLabel=為了安裝本軟件,至少需要 [mb] MB 的空閑磁盤空間。
 ToUNCPathname=安裝程序不能安裝到一個 UNC 目錄名稱。如果您試圖網(wǎng)上安裝本程序,請映射網(wǎng)絡(luò)驅(qū)動器。
 InvalidPath=您比如輸入一個含盤符的路徑名稱。比如:%n%nC:\APP%n%n 或者一個網(wǎng)絡(luò)路徑,例如:%n%n\\server\share
 InvalidDrive=您選擇的磁盤或者網(wǎng)絡(luò)路徑不存在或者不能訪問。請重新選擇其它的磁盤或者網(wǎng)絡(luò)路徑。
 DiskSpaceWarningTitle=磁盤空間不足。
 DiskSpaceWarning=安裝程序至少需要 %1 KB 空閑磁盤空間來安裝本軟件。但是選擇的磁盤上只有 %2 KB 空間可用。%n%n 您確認繼續(xù)?
 DirNameTooLong=該文件夾的名稱太長。
 InvalidDirName=該文件夾的名字太長。
 BadDirName32=文件夾名稱中不能包括以下的任何字符:%n%n%1
 DirExistsTitle=文件夾已經(jīng)存在
 DirExists=文件夾:%n%n%1%n%n已經(jīng)存在。您想繼續(xù)安裝?
 DirDoesntExistTitle=文件夾不存在
 DirDoesntExist=文件夾:%n%n%1%n%n不存在。您想創(chuàng)建該文件夾?
 
 ; *** "Select Components" wizard page
 WizardSelectComponents=選擇部件
 SelectComponentsDesc=哪些部件需要安裝?
 SelectComponentsLabel2=選擇您想要安裝的部件; 清除您不想安裝的部件。當(dāng)您準(zhǔn)備好后,請單擊“下一步” 。
 FullInstallation=完全安裝
 ; if possible don't translate 'Compact' as 'Minimal' (I mean 'Minimal' in your language)
 CompactInstallation=精簡安裝
 CustomInstallation=自定義安裝
 NoUninstallWarningTitle=部件存在
 NoUninstallWarning=安裝程序檢測到以下部件已經(jīng)在您的電腦中被安裝了:%n%n%1%n%n不選擇它們將不在您的電腦中安裝它們。%n%n您想就這樣繼續(xù)嗎?
 ComponentSize1=%1 KB
 ComponentSize2=%1 MB
 ComponentsDiskSpaceMBLabel=當(dāng)前選擇項至少需要 [mb] MB 的空閑磁盤空間才能安裝。
 
 ; *** "Select Additional Tasks" wizard page
 WizardSelectTasks=選擇一個附加任務(wù)
 SelectTasksDesc=您想選擇哪個附加任務(wù)?
 SelectTasksLabel2=選擇在安裝[name]時執(zhí)行的附加任務(wù), 然后單擊“下一步”。
 
 ; *** "Select Start Menu Folder" wizard page
 WizardSelectProgramGroup=選擇開始菜單文件夾
 SelectStartMenuFolderDesc=您想在哪里放置軟件的快捷方式?
 SelectStartMenuFolderLabel3=安裝程序?qū)⒃谙旅娴奈募A中創(chuàng)建軟件的快捷方式。
 SelectStartMenuFolderBrowseLabel=為了繼續(xù),單擊“下一步”。如果您想另外選擇一個文件夾,單擊“瀏覽”。
 MustEnterGroupName=您必須輸入一個文件夾名稱。
 GroupNameTooLong=文件夾名稱或者路徑名稱太長。
 InvalidGroupName=文件夾名稱非法。
 BadGroupName=文件夾名字中不能包含下面的字符:%n%n%1
 NoProgramGroupCheck2=不創(chuàng)建開始菜單中的文件夾[&D]
 
 ; *** "Ready to Install" wizard page
 WizardReady=準(zhǔn)備開始安裝
 ReadyLabel1=安裝程序開始在您的電腦中安裝[name].
 ReadyLabel2a=單擊“安裝”開始安裝本軟件,或者單擊“回退”修改安裝設(shè)置。
 ReadyLabel2b=單擊“安裝”開始安裝本軟件。
 ReadyMemoUserInfo=用戶信息:
 ReadyMemoDir=安裝目標(biāo)位置:
 ReadyMemoType=安裝種類:
 ReadyMemoComponents=選中的部件:
 ReadyMemoGroup=開始菜單文件夾:
 ReadyMemoTasks=附加任務(wù):
 
 ; *** "Preparing to Install" wizard page
 WizardPreparing=準(zhǔn)備安裝
 PreparingDesc=安裝程序準(zhǔn)備在您的電腦中安裝[name]。
 PreviousInstallNotCompleted=安裝/卸載一個以前的程序沒有完成。您需要重新啟動您的電腦來完成安裝工作。%n%n當(dāng)重新啟動您的電腦后,請運行安裝程序來完成安裝[name]。
 CannotContinue=安裝程序不能繼續(xù)執(zhí)行。請單擊“放棄”退出。
 
 ; *** "Installing" wizard page
 WizardInstalling=安裝中
 InstallingLabel=安裝程序正在安裝[name],請等待。
 
 ; *** "Setup Completed" wizard page
 FinishedHeadingLabel=[name]安裝完成
 FinishedLabelNoIcons=安裝程序已經(jīng)在您的電腦中安裝了[name]。
 FinishedLabel=安裝程序已經(jīng)在您的電腦中安裝了[name]。要執(zhí)行本軟件,請單擊安裝好的本軟件圖標(biāo) 。
 ClickFinish=單擊“完成”退出本安裝程序.
 FinishedRestartLabel=為了完成[name]的安裝, 安裝程序必須重新啟動您的電腦。您想現(xiàn)在就重新啟動?
 FinishedRestartMessage=為了完成[name]的安裝, 安裝程序必須重新啟動您的電腦。%n%您想現(xiàn)在就重新啟動?
 ShowReadmeCheck=是的,我想查看 README 文件
 YesRadio=是的,我想重新啟動計算機[&Y]
 NoRadio=不,我將稍后重新啟動計算機[&N]
 ; used for example as 'Run MyProg.exe'
 RunEntryExec=運行 %1
 ; used for example as 'View Readme.txt'
 RunEntryShellExec=查看 %1
 
 ; *** "Setup Needs the Next Disk" stuff
 ChangeDiskTitle=安裝程序需要下一個安裝盤
 SelectDiskLabel2=請插入安裝盤 %1 并且單擊“確認”。%n%n如果該盤不是下面顯示的盤,請輸入正確的路徑或者單擊“瀏覽”。
 PathLabel=目錄[&P]:
 FileNotInDir2=在 "%2" 中沒有發(fā)現(xiàn)文件。請插入正確的磁盤或者選擇其它的文件夾。
 SelectDirectoryLabel=請輸入下一個磁盤中的正確位置。
 
 ; *** Installation phase messages
 SetupAborted=安裝沒有完成。%n%n請修復(fù)錯誤并重新安裝。
 EntryAbortRetryIgnore=單擊“重試”重新嘗試,單擊“忽略”將繼續(xù)安裝,或者單擊“放棄”退出安裝。
 
 ; *** Installation status messages
 StatusCreateDirs=創(chuàng)建目錄中...
 StatusExtractFiles=解壓文件中...
 StatusCreateIcons=創(chuàng)建快捷方式中...
 StatusCreateIniEntries=創(chuàng)建INI單元中...
 StatusCreateRegistryEntries=創(chuàng)建注冊表內(nèi)容中...
 StatusRegisterFiles=注冊文件中...
 StatusSavingUninstall=保存卸載信息中...
 StatusRunProgram=正在完成安裝...
 StatusRollback=恢復(fù)原來修改的內(nèi)容中...
 
 ; *** Misc. errors
 ErrorInternal2=內(nèi)部錯誤: %1
 ErrorFunctionFailedNoCode=%1 失敗
 ErrorFunctionFailed=%1 失敗; 代碼 %2
 ErrorFunctionFailedWithMessage=%1 錯誤; 代碼 %2.%n%3
 ErrorExecutingProgram=不能執(zhí)行文件:%n%1
 
 ; *** Registry errors
 ErrorRegOpenKey=在打開注冊表鍵時發(fā)生錯誤:%n%1\%2
 ErrorRegCreateKey=在創(chuàng)建注冊表鍵時發(fā)生錯誤:%n%1\%2
 ErrorRegWriteKey=在些注冊表鍵時發(fā)生錯誤:%n%1\%2
 
 ; *** INI errors
 ErrorIniEntry=在創(chuàng)建INI文件時發(fā)生錯誤 "%1".
 
 ; *** File copying errors
 FileAbortRetryIgnore=單擊“重試”再試一次,單擊“忽略”忽略該文件,或者單擊“放棄”退出安裝程序。
 FileAbortRetryIgnore2=單擊“重試”再試一次,單擊“忽略”忽略該文件繼續(xù)安裝,或者單擊“放棄”退出安裝程序。
 SourceIsCorrupted=源文件被使用
 SourceDoesntExist=源文件 "%1" 不存在
 ExistingFileReadOnly=該已經(jīng)存在的文件是只讀屬性。%n%n單擊“重試”刪除只讀屬性并重新嘗試,單擊“忽略”忽略該文件,或者單擊“放棄”退出安裝程序。
 ErrorReadingExistingDest=當(dāng)試圖讀取一個已經(jīng)存在的文件時發(fā)生了錯誤:
 FileExists=該文件已經(jīng)存在。%n%n您想覆蓋它嗎?
 ExistingFileNewer=已經(jīng)存在的文件比安裝程序試圖安裝的文件要新。建議您保留該文件。%n%n您想保留已經(jīng)存在的文件嗎?
 ErrorChangingAttr=當(dāng)試圖改變一個存在的文件的屬性時發(fā)生了錯誤:
 ErrorCreatingTemp=當(dāng)試圖在目標(biāo)目錄中創(chuàng)建一個文件時發(fā)生了錯誤:
 ErrorReadingSource=當(dāng)試圖讀取一個文件時發(fā)生了錯誤:
 ErrorCopying=當(dāng)試圖復(fù)制一個文件時發(fā)生了錯誤:
 ErrorReplacingExistingFile=當(dāng)試圖覆蓋已經(jīng)存在的文件時發(fā)生錯誤:
 ErrorRestartReplace=重新啟動置換失敗:
 ErrorRenamingTemp=當(dāng)在目標(biāo)目錄中重命名文件時發(fā)生錯誤:
 ErrorRegisterServer=不能注冊 DLL/OCX: %1
 ErrorRegisterServerMissingExport=沒有Dll注冊服務(wù)庫輸出
 ErrorRegisterTypeLib=不能注冊以下類型庫: %1
 
 ; *** Post-installation errors
 ErrorOpeningReadme=當(dāng)打開 README 文件時發(fā)生錯誤。
 ErrorRestartingComputer=安裝程序不能重新啟動電腦。請手動啟動。
 
 ; *** Uninstaller messages
 UninstallNotFound=文件 "%1" 不存在。不能卸載。
 UninstallOpenError=文件 "%1" 不能打開。不能卸載。
 UninstallUnsupportedVer=卸載記錄文件 "%1" 不是基于本安裝程序的版本。不能完成軟件的刪除工作。
 UninstallUnknownEntry=一個未知的實體 (%1) 存在于卸載記錄文件中。
 ConfirmUninstall=您確定完全刪除 %1 和所有基于它上面的部件嗎?
 UninstallOnlyOnWin64=該安裝程序只能在64位的Windows上執(zhí)行卸載工作。
 OnlyAdminCanUninstall=該安裝程序只能在您具有管理員權(quán)限時才能執(zhí)行卸載工作。
 UninstallStatusLabel= %1 正在被刪除,請稍等。
 UninstalledAll=%1 被成功地從您的電腦中刪除。
 UninstalledMost=%1 刪除完成。%n%n有某些部件不能被刪除。您可能需要手動刪除它們。
 UninstalledAndNeedsRestart=為了完成 %1 的刪除工作, 您必須重新啟動電腦。%n%n您想現(xiàn)在就重新啟動嗎?
 UninstallDataCorrupted=文件"%1" 被占用。不能完成刪除工作。
 
 ; *** Uninstallation phase messages
 ConfirmDeleteSharedFileTitle=刪除共享程序文件?
 ConfirmDeleteSharedFile2=系統(tǒng)指出以下的共享程序文件將不再被使用。您是否想刪除這些共享文件?%n%n如果這些文件刪除后,其他程序仍然要使用它,可能其它程序的功能將受影響。如果您不能肯定,請選擇“否”。讓這些文件保留在系統(tǒng)中不會對系統(tǒng)造成損害。
 SharedFileNameLabel=文件名:
 SharedFileLocationLabel=位置:
 WizardUninstalling=卸載
 StatusUninstalling=卸載 %1 中...
 
 ; The custom messages below aren't used by Setup itself, but if you make
 ; use of them in your scripts, you'll want to translate them.
 
 [CustomMessages]
 
 NameAndVersion=%1 版本 %2
 AdditionalIcons=附加圖標(biāo):
 CreateDesktopIcon=創(chuàng)建桌面圖標(biāo)[&d]
 CreateQuickLaunchIcon=創(chuàng)建快速啟動圖標(biāo)[&Q]
 ProgramOnTheWeb=%1 on the Web
 UninstallProgram=卸載 %1
 LaunchProgram=執(zhí)行 %1
 AssocFileExtension=用文件擴展名 %2 匹配[&A] %1?
 AssocingFileExtension=正在用文件擴展名 %2 匹配[&A] %1 中...

7.打包

打開Inno Setup,通過右上角File->New新建Inno Setup打包文件。設(shè)置應(yīng)用程序信息

設(shè)置安裝目錄為前面的程序發(fā)布目錄

添加卸載快捷鍵

設(shè)置licence信息

選擇安裝模式

選擇漢化語言

設(shè)置輸出目錄

腳本中添加安裝命令,卸載命令

[Run]
Filename: "{sys}\sc.exe"; Parameters: "stop MyService" ; Flags: runhidden
Filename: "{sys}\sc.exe"; Parameters: "delete MyService" ; Flags: runhidden
Filename: "{sys}\sc.exe"; Parameters: "create MyService start=auto binPath=""{app}\MyWeb.exe""" ; Flags: runhidden
Filename: "{sys}\sc.exe"; Parameters: "start MyService" ; Flags: runhidden

[UninstallRun]
Filename: "{sys}\sc.exe"; Parameters: "stop MyService" ; Flags: runhidden
Filename: "{sys}\sc.exe"; Parameters: "delete MyService" ; Flags: runhidden

腳本最終內(nèi)容

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "MyService"
#define MyAppVersion "1.0.0"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "https://www.example.com/"

[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{0C9603FD-2587-41FD-A532-CB5294E7B56E}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=D:\Mylicence.txt
InfoBeforeFile=D:\Myshowafter.txt
InfoAfterFile=D:\Myshowbefore.txt
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
OutputDir=C:\Users\c\Desktop
OutputBaseFilename=mysetup
Compression=lzma
SolidCompression=yes
WizardStyle=modern

[Languages]
Name: "chinese"; MessagesFile: "compiler:Languages\Chinese.isl"

[Files]
Source: "D:\MyWeb\bin\Release\net6.0\publish\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"


[Run]
Filename: "{sys}\sc.exe"; Parameters: "stop MyService" ; Flags: runhidden
Filename: "{sys}\sc.exe"; Parameters: "delete MyService" ; Flags: runhidden
Filename: "{sys}\sc.exe"; Parameters: "create MyService start=auto binPath=""{app}\MyWeb.exe""" ; Flags: runhidden
Filename: "{sys}\sc.exe"; Parameters: "start MyService" ; Flags: runhidden

[UninstallRun]
Filename: "{sys}\sc.exe"; Parameters: "stop MyService" ; Flags: runhidden
Filename: "{sys}\sc.exe"; Parameters: "delete MyService" ; Flags: runhidden

8.打包編譯

點擊編譯按鈕,打包好后,雙擊exe安裝

9.檢驗安裝

首先去windows 服務(wù)查看是否安裝成功

然后訪問服務(wù)

至此打包安裝完成。

總結(jié)

到此這篇關(guān)于.NET6打包部署到Windows Service的文章就介紹到這了,更多相關(guān).NET6打包部署Windows Service內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論