加一个调试器,挂到进程上作step by step的调试。 或者写一个winform版的程序,在上面调试。 或者往常需要MessageBox.show()的信息,在service中可以将其写入一个文本文件来察看对应的信息。
To 大家写Windows Service的时候是如何step by step的调试的呢?如果想单步跟踪,可以把相应的代码转移到Form程序中;如果比较稳定,可以用写log文件来查看。To 另外可不可以让Windows Service显示一个notifyicon呢?mouse click的时候显示一个windows form?本身是不行的,但是你可以在Service启动的时候去开启一个Form程序,用它来进行显示即可以NotifyIcon+Form。
根据这位老兄所说的情况,我建议如下调试方法: 1、首先安装windows service到windows service中 2、启动这个服务。 3、进入到.net开发环境中 4、选择菜单项目/属性,进入项目属性对话框 5、打开配置属性/debugging/debug mode,选择"Wait to Attach to an External Process" 6、选择调菜单调试/processes,在available processes种选择要调试的服务,点击attach,然后关闭这个对话框,就可以进行常规的调试了,包括单步调试
tutuaction(天安门前的小草) : Project -> Properties -> Configuration Properties -> Debugging 下有如下内容: Start Action Start Project Start external program Start URL Start Options Command line arguments Working directory Use remote machine Always use Internet Explorer when debuggin Web pages Debyggers Enable: Asp.Net debugging ASP debugging Unmanaged code debugging SQL Server debugging可是,没有 debug mode 一项,更加没有 “Wait to Attach to an External Process” 这一选项。!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!请指教。
另外WindowsService里有没有System.windows.forms.application.name的功能?
或者写一个winform版的程序,在上面调试。
或者往常需要MessageBox.show()的信息,在service中可以将其写入一个文本文件来察看对应的信息。
1、首先安装windows service到windows service中
2、启动这个服务。
3、进入到.net开发环境中
4、选择菜单项目/属性,进入项目属性对话框
5、打开配置属性/debugging/debug mode,选择"Wait to Attach to an External Process"
6、选择调菜单调试/processes,在available processes种选择要调试的服务,点击attach,然后关闭这个对话框,就可以进行常规的调试了,包括单步调试
Start Project
Start external program
Start URL
Start Options
Command line arguments
Working directory
Use remote machine
Always use Internet Explorer when debuggin Web pages
Debyggers
Enable: Asp.Net debugging
ASP debugging
Unmanaged code debugging
SQL Server debugging可是,没有 debug mode 一项,更加没有 “Wait to Attach to an External Process” 这一选项。!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!请指教。