調試Windows Service
標簽:
SQL Server
1、安装Service: InstallUtil yourService.exe
2、卸载Service InstallUtil /u yourService.exe
如果 service在运行,该命令会尝试停止Serive再卸载。
3、启动Service Net start "Your Service"
"Your Service"是ProjectInstaller类里 system.ServiceProcess.ServiceInstaller.ServiceName的值,它是你在Service管理器里可以看到的Service名称。
4、调试Service 启动Visual Studio 2008,打开你的yourService project.选择菜单"Debug->Attach to Process..."。
5、在Attach to Process窗口里attach yourSerice.exe。如果你看不到你的yourSerice.exe,请选中"Show processes from all users".这样你才能看到以system账号运行的Service. 如果你已经设置了断点,当Serice运行到你设置的断点时,程序就会停下来等待你的调试。
6、为了能够调试yourService.exe, yourService.exe必须是在Debug模式下。
點擊查看更多內容
為 TA 點贊
評論
評論
共同學習,寫下你的評論
評論加載中...
作者其他優質文章
正在加載中
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦