CodeSite 5.3.3 – TCP and background services, dispatcher as a service.

Home Forums CodeSite CodeSite 5.3.3 – TCP and background services, dispatcher as a service.

Viewing 2 reply threads
  • Author
    Posts
    • #1408
      WARREN POSTMA
      Participant

        I am following the help topics on how to do some logging from an executable that is running as a windows service.

        If the dispatcher is running as a tray icon (started manually because it won’t auto start) I get no codesite output.

        If I try to run the dispatcher as a service, the service fails to start.

        Using net start to start the service not much error message is shown:

        C:\Program Files (x86)\Raize\CS5\Bin> net start CodeSiteDispatcher
        The service is not responding to the control function.

        But from the service control UI a different error that is more descriptive is shown.

        Windows could not start the CodeSite Dispatcher service on Local Computer.

        Error 1053: The service did not respond to the start or control request in a timely fashion.

        I tried changing the user that is logged on from the default in the service configuration, still no luck.

        It appears that it is not possible on Windows 10 to run the CSDispatcher.exe from the service context?

        Warren Postma

      • #1409
        WARREN POSTMA
        Participant

          Oddly, on this computer, after a reboot or two, this symptom mysteriously went away and while the service WILL start up, it doesn’t actually work.
          (No code site live view abilities)

        • #1414
          Ray Konopka
          Keymaster

            Hi Warren,

            Sending CodeSite messages from service apps is a bit tricky because of 2 reasons. The first is the communication restriction that Microsoft has placed between window stations. And the second is the communication method that CodeSite uses to send messages.

            When you are trying to send CodeSite messages from a service app, you have two choices. The first is to change the communication method that the CodeSite Logger classes use to send messages to the CodeSite Dispatcher. The default method uses wm_CopyData window messages. However, window messages are no longer allowed to be sent across window stations. Therefore, you can switch the method to use TCP. To do this, you need to call the ConnectUsingTcp() method on the CodeSiteManager (or on an individual logger instance). The logger classes will then use TCP to send the CodeSite messages to the Dispatcher, which is presumably running on the currently logged in users desktop (window station). In this case, Live Logging will continue to work because the Dispatcher will be able to send wm_CopyData window messages to the CodeSite Live Viewer (also running on the desktop).

            The other way of using CodeSite in a service application is to actually run the CodeSite Dispatcher as a service. In this case, the Dispatcher is running in the same window station as the service app and the wm_CopyData messages will get through from the logging classes to the Dispatcher. This arrangement is typically used when you need to log information from the service app and there is no active user and no user desktop. Furthermore, in this arrangement, you can really only send CodeSite messages to a log file and not the Live Viewer. The reason Live Logging does not work, is related to the information described above. The Dispatcher is running in the Service space and the Live Viewer is running (if it is running) in a user’s desktop station. The Dispatcher uses wm_CopyData to send messages to the Live Viewer–and unlike the Logging Classes to Dispatcher communication which can be changed to TCP, the Dispatcher to Live Viewer communication cannot.

            So, I hope the above helps clarify things for you. If you do not need to run the Dispatcher as a service, (as described above), then I would run it as a normal app and then just call the ConnectUsingTcp method on the CodeSiteManager inside your service app code (before trying to send any CodeSite messages), and then you should be able to see your CodeSite messages appear in the Live Viewer.

            Ray

        Viewing 2 reply threads
        • You must be logged in to reply to this topic.