No Messages in Windows Service after ServiceExecute

Have a CodeSite question that doesn't fit into any of the forums below? Post it here.

No Messages in Windows Service after ServiceExecute

Postby etwoss » Sun Oct 20, 2013 3:55 am

Hi

CodesiteDispatcher is running as a service, my service uses TCP and write to file
Whatever i try no more message after ServiceExecute come in the file

I tried local admin with chechbox allow talk to desktop on and tried it with logging in with username/password

Eric
etwoss
 
Posts: 20
Joined:
Sat Oct 19, 2013 4:22 am

Re: No Messages in Windows Service after ServiceExecute

Postby Raize Support » Mon Oct 21, 2013 2:40 am

Hi,

Does your service code call ConnectUsingTcp before sending any CodeSite messages? I recommend reading the CodeSite Help, in particular the Advanced Techniques section.

Ray
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 610
Joined:
Fri Mar 25, 2011 9:04 pm

Re: No Messages in Windows Service after ServiceExecute

Postby etwoss » Mon Oct 21, 2013 2:46 am

Hi ray

My solution already works for some years now, only on this specfic server i can't get it working.

Code:
IMCsAppDestination.LogFile.Active := True;
IMCsAppDestination.LogFile.FilePath := ExtractFilePath(LDestination);
IMCsAppDestination.LogFile.FileName := ExtractFileName(LDestination);
IMCsAppDestination.LogFile.LogByDate := True;
IMCsAppDestination.LogFile.LogByDateFormat := 'yyyymmdd';
IMCsAppDestination.LogFile.MaxSize := LIniFile.ReadInteger(Key, MAXSIZE , 1024);
IMCsAppDestination.LogFile.MaxParts := LIniFile.ReadInteger(Key, MAXPARTS , 100);


if LIniFile.ReadBool(Key, TRANSPORTMETHOD , False) then
begin
IMCsAppDestination.TCP.Active := True;
IMCsAppDestination.TCP.Host := 'localhost';
IMCsAppDestination.TCP.Port := 3434;

if IMCsAppDestination.LogFile.Active then
begin
IMCsAppDestination.TCP.RemoteDestinationString :=
'File[Path=' +
IncludeTrailingPathDelimiter(IMCsAppDestination.LogFile.FilePath) + ';' +
IMCsAppDestination.LogFile.FileName + ';' +
'MaxSize=' + IntToStr(IMCsAppDestination.LogFile.MaxSize) + ';' +
'MaxParts=' + IntToStr(IMCsAppDestination.LogFile.MaxParts) + ']';

if IMCsAppDestination.Viewer.Active then
begin
IMCsAppDestination.TCP.RemoteDestinationString :=
'Viewer,' + IMCsAppDestination.TCP.RemoteDestinationString;
end;

end;
CodeSiteObject.ConnectUsingTcp('localhost',3434);
end;
etwoss
 
Posts: 20
Joined:
Sat Oct 19, 2013 4:22 am

Re: No Messages in Windows Service after ServiceExecute

Postby Raize Support » Mon Oct 21, 2013 5:19 am

Hi Eric,

First of all, in the configuration that you have, there is no real need to have the TCP destination type. The destination is the same computer, and it not gaining you anything.

To understand this, it would be helpful to understand the communication path a CodeSite message takes. Basically, there are 2 steps in the communication process. The first step is between your application code and the CodeSite Dispatcher. The default method for this communication channel is wm_CopyData, which is very fast and lightweight. However, wm_CopyData cannot be used to cross window-station boundaries. This is an issue when you have service applications and the Dispatcher is running as a regular application. That is, the Dispatcher is running in a different window-station. In this case, the ConnectUsingTcp method must be called to instruct the TCodeSiteLogger instances to send their CodeSite messages to the Dispatcher using TCP.

The second communication channel is between the CodeSite Dispatcher and the Destination(s). This is where the TCodeSiteDestination is used. The Dispatcher uses the Destination properties to determine what to do with the messages. If a log file is specified, then the Dispatcher saves the message to the log file. If the Viewer is specified, the message is sent to the Live Viewer. If TCP is specified, the current (local) dispatcher sends the message to a remote dispatcher. (In your code, the remote dispatcher is the same as the local one). When using TCP, the remote dispatcher uses the RemoteDestinationDetails property to determine what to do with that message.

Going back to your original post, what specifically do you mean by "Whatever I try no more message after ServiceExecute come in the file"?

Also, what version of Windows are you using? And, what type of application is generating the CodeSite messages? That is, is it a service application, or a regular desktop app?

Ray
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 610
Joined:
Fri Mar 25, 2011 9:04 pm

Re: No Messages in Windows Service after ServiceExecute

Postby etwoss » Mon Oct 21, 2013 6:09 am

Hi ray

The server runs on Windows 2003 R2
My application is indeed a Windows service application, codesitedispatcher is also running as a service

I have codesite in ServiceStart and ServiceExecute

In the serviceExecute a INI file is read and i sent the values also with codesite

In the logfile i only see the codesite (tracemethod) message from ServiceStart and ServiceExecute bit not those of the ini values.

Eric
etwoss
 
Posts: 20
Joined:
Sat Oct 19, 2013 4:22 am

Re: No Messages in Windows Service after ServiceExecute

Postby Raize Support » Tue Oct 22, 2013 1:58 am

Given that the TraceMethod messages are showing up in the log, this would suggest that either the code that is sending the values of the INI file is not being called, or the CodeSite logger used to send the message is different than the one used for the TraceMethod calls, and that other logger is disabled.

Ray
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 610
Joined:
Fri Mar 25, 2011 9:04 pm

Re: No Messages in Windows Service after ServiceExecute

Postby etwoss » Tue Oct 22, 2013 9:48 am

Hi Ray

Found the problem, just another stupid cut/copy/past error.
Next time we meet the first 3 drinks are on me!
Sorry taking your time

Eric
etwoss
 
Posts: 20
Joined:
Sat Oct 19, 2013 4:22 am

Re: No Messages in Windows Service after ServiceExecute

Postby Raize Support » Tue Oct 22, 2013 12:54 pm

That's great. Glad you were able to locate the issue.

Ray
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 610
Joined:
Fri Mar 25, 2011 9:04 pm


Return to General

Who is online

Users browsing this forum: No registered users and 2 guests