> Is it possible?
> How?
If you separate out the core service logic into separate classes you can
then use a test framework windows forms application to do most of your
debugging.
--
-Mike (TeamB)
Newsgroup guidelines: http://www.borland.com/newsgroups/guide.html
"Mike Williams [TeamB]" <mlwil...@gmail.com> escreveu na mensagem
news:Xns958E7395B7...@207.105.83.66...
Vlastik
> > Is it possible?
> > How?
Another option is to use SvCom:
http://www.aldyn-software.com/svcom.html
Sasan.
> Is it possible?
> How?
OutputDebugString() plus DebugView
(http://www.sysinternals.com/ntw2k/freeware/debugview.shtml)
You could even debug a remote machine...
--
Ben
Second, you can attach a debugger to a running service process.
Third, the most difficult aspect of services debugging is dealing with
problems that occur during service startup. Running the code outside of
the service is no good. Attaching the debugger once the service is
running is also of no help.
You can use the registry to cause the debugger to be launched as the
service starts up, but understand that the SCM only gives you a limited
time to get going before it kills your primary service thread. Loading a
debugger and the service can blow this time budget.
HKLM\software\microsoft\windows nt\currentversion\image file execution
options
is the place in the registry to modify. You create a new key with the
name of your service executable. Create a Debugger string value entry
and put the necessary command string to execute the debugger and have it
attach to the process.
Chris.
> Debug a service application
>
> Is it possible?
> How?
>
> Thanks.
> Ricardo Carmo
I use two approaches...
1. The simplest way is to compile the service, start it with the
service control manager, then use 'Run/Attach to process' to make
Delphi attach itself to the running service. You'll need to click the
'Show System Processes' checkbox in the 'Attach to Process' dialog in
Delphi.
2. Run your service as a regular application. You can then debug it
like you would debug any program. To facilitate doing this I've
published a free TDebugServiceApplication object - available in the 'NT
Low Level Utilities' package on my website. You use it like this...
In your services .DPR file - where it used to look like this...
program TestService;
uses
SvcMgr,
TestServiceImpl in 'TestServiceImpl.pas' {Service1: TService};
{$R *.RES}
begin
Application.Initialize;
Application.CreateForm(TService1, Service1);
Application.Run;
end.
Make it look like this...
program TestService;
uses
SvcMgr,
unitDebugService,
TestServiceImpl in 'TestServiceImpl.pas' {Service1: TService};
{$R *.RES}
begin
if (paramCount > 0) and (SameText (ParamStr (1), '-DEBUG')) then
begin
FreeAndNil (Application);
Application := TDebugServiceApplication.Create(nil);
end;
Application.Initialize;
Application.CreateForm(TService1, Service1);
Application.Run;
end.
Now, when you run your service with a '-debug' parameter it will run as
an application. I do this with all my services, so it's all well
tested. Give it a try - it works!
--
Colin - using XanaNews HTTP Transport
e-mail :co...@wilsonc.demon.co.uk
web: http://www.wilsonc.demon.co.uk/delphi.htm
Posted with XanaNews 1.16.5.1