MaelstromCdn 0 Newbie Poster

Hello everyone,
I am working on an application that uses .NET Remoting to communicate between a Windows Service and a client program. I am trying to use Activator.GetObject from the service to access data in the remoting server. Unfortunately, the service reaches the code where I request the data from the remoting server and never gets past it. The code after that line is never executed and an exception is never caught. I can't figure out what I'm doing wrong. The code is below. Any help or suggestions would be greatly appreciated.
Jason Lewis

Remoting Object
---------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Contexts;
namespace MCCSharedLib
{
    [Serializable()]
    public class OutData
    {
        /*-------------------------------------------------*/
        [Serializable()]
        public struct OutItems
        {
            public int iNumUnits;
            public int iAType;
            public int iBType;
     ... 
            public bool bAAdvanced;
            public bool bBAdvanced;
        };
        public OutItems m_OutItems;
        /*-------------------------------------------------*/
        public OutItems OutputItems
        {
            get { return m_OutItems; }
            set { m_OutItems = value; }
        }
        /*-------------------------------------------------*/
        public OutData()
        {
            // Initialize the OutItems struct.
            m_OutItems = new OutItems();
            m_OutItems.iNumUnits = 1;
            m_OutItems.iAType = 2;
            m_OutItems.iBType = 2;
            ...
            m_OutItems.bAAdvanced = false;
            m_OutItems.bBAdvanced = false;
        }
        /*-------------------------------------------------*/
    }
}
ILoadMenu Interface
-------------------
using System;
using System.Collections.Generic;
using System.Text;
using MCCSharedLib;
namespace MCCRemoteClient
{
    public interface IGetData
    {
        /*-------------------------------------------------*/
        InData GetData();
        /*-------------------------------------------------*/
    }
    public interface ISetData
    {
        /*-------------------------------------------------*/
        void SetData(MCCSharedLib.OutData.OutItems _OutData);
        /*-------------------------------------------------*/
    }
}
Server
------
using System;
using System.Collections.Generic;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Text;
using System.ComponentModel;
using System.Data;
using System.Threading;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using MCCRemoteClient;
using MCCSharedLib;
 
namespace MCCRemoteServer
{
    public class MenuManager : MarshalByRefObject, IGetData, ISetData
    {
        private System.Threading.Timer m_HIDTimer;
        private MCCSharedLib.OutData m_OutItems;
        public MenuManager()
        {
            m_OutItems = new OutData();
            // Set up the timer
            TimerCallback timerDelegate = new TimerCallback(UpdateData);
            m_HIDTimer = new Timer(timerDelegate, null, 1000, 1000);
        }
        public override Object InitializeLifetimeService()
        {
            return null;
        }
        private void UpdateData(object state)
        {
            ... (works fine)
        }
        /*-------------------------------------------------*/
        // This method implements the ILoadMenu interface.
        public MCCSharedLib.InData GetData()
        {
            return m_DataItems;
        }
        public void SetData(MCCSharedLib.OutData.OutItems _OutData)
        {
            m_OutItems.OutputItems = _OutData;
        }
        /*-------------------------------------------------*/
        public MCCSharedLib.OutData.OutItems GetOutData()
        {
            OutData.OutItems TempData = new OutData.OutItems();
            TempData = m_OutItems.m_OutItems;
            return TempData;
        }
    }
}
Windows Service
---------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.Runtime.InteropServices;
using MCCRemoteServer;
using MCCRemoteClient;
using MCCSharedLib;
namespace MCCRemoteService
{
    public partial class MCCRemoteService : ServiceBase
    {
        private MCCSharedLib.OutData.OutItems m_OutItems;
        private System.Threading.Timer m_HIDTimer;
        /*-------------------------------------------------*/
        public MCCRemoteService()
        {
            m_OutItems = new OutData.OutItems();
            InitializeComponent();
            // Set up the timer
            TimerCallback timerDelegate = new TimerCallback(UpdateData);
            m_HIDTimer = new Timer(timerDelegate, null, 1000, 1000);
        }
        private void UpdateData(object state)
        {
            MCCSharedLib.OutData.OutItems OutItems;
            MenuManager RemoteObj = (MenuManager)Activator.GetObject(typeof(MenuManager), "[url]http://localhost:9250/RemoteObject[/url]");
            try
            {
                // Update the output information ------------------------------
                OutItems = RemoteObj.GetOutData();   ******************** Line in question *******************
                ... (more code, never reached)
            }
            catch (Exception ex)
            {
            }
        }
        /*-------------------------------------------------*/
        protected override void OnStart(string[] args)
        {
            TcpServerChannel channel;
            // Register the TCP channel
            channel = new TcpServerChannel(9250);
            // Register our channel.
            ChannelServices.RegisterChannel(channel, true);
            // Set up the object binding and behavior.
            RemotingConfiguration.RegisterWellKnownServiceType
                        (typeof(MenuManager), "MenuManager", 
                        WellKnownObjectMode.Singleton);
        }
    }
}