Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9106349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:19:05+00:00 2026-06-17T02:19:05+00:00

I have a service which needs to pump strings to a helper application which

  • 0

I have a service which needs to pump strings to a helper application which displays critical messages from the service to the user (Vista+ does not give services access to the GUI). Since I’ve used .NET Remoting over TCP, I figured I’d do the same with the IPC protocol. However, after getting the reference to the remote object, I get the following exception when making a call to the remote method:

MissingMethodException: No parameterless constructor defined for this object.

Simply adding a parameterless constructor to the class gives me a NullReferenceException when making the call instead. What is it that I am doing wrong? I’ve included my relevant code below:

Application Code

public class MyMsgBus : MarshalByRefObject, IDisposable, IMxServeBus
{
    private Thread myThread = null;
    private volatile List<string> myMsgBus = null;
    private volatile bool myThreadAlive = false;
    private volatile bool myIsDisposed = false;
    private volatile bool myIsDisposing = false;
    private IpcChannel myIpc = null;

    public MyMsgBus(string busname)
    {
       myMsgBus = new List<string>();

       myIpc = CreateIpcChannel(busname);
       ChannelServices.RegisterChannel(myIpc);

       var entry = new WellKnownServiceTypeEntry(
          typeof(MxServeBus),
          "MyRemoteObj.rem",
          WellKnownObjectMode.Singleton);

       RemotingConfiguration.RegisterWellKnownServiceType(entry);
    }

    // defined in IMyMsgBus
    public void SendMessage(string message)
    {
       // do stuff
    }

    public static IpcChannel CreateIpcChannel(string portName)
    {
       var serverSinkProvider = new BinaryServerFormatterSinkProvider();
       serverSinkProvider.TypeFilterLevel = TypeFilterLevel.Low;

       IDictionary props = new Hashtable();
       props["portName"] = portName;
       props["authorizedGroup"] = "Authenticated Users";

       return new IpcChannel(props, null, serverSinkProvider);
    }

    public static IpcChannel CreateIpcChannelWithUniquePortName()
    {
       return CreateIpcChannel(Guid.NewGuid().ToString());
    }
}

Test Client

static void Main(string[] args)
{
   var channel = MyMsgBus.CreateIpcChannelWithUniquePortName();
   ChannelServices.RegisterChannel(channel, true);

   var objUri = "ipc://MyMsgBus/MyRemoteObj.rem";
   IMyMsgBus lBus = (IMyMsgBus)Activator.GetObject(typeof(IMyMsgBus), objUri);
   lBus.SendMessage("test");
   Console.WriteLine();
}

Thanks in advance for any assistance on this. As an FYI, this is a remoting instance configured through the use of a shared interface, where IMyMsgBus defines the methods which should be available to call over IPC.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:19:06+00:00Added an answer on June 17, 2026 at 2:19 am

    You are getting NullReferenceException on adding parameterless constructor as parameter is required for proper initialization. By not supplying it, some part of initialization is missed.

    You should refactor your code to allow parameter less constructor as

       private bool _initialized = false;
    
        public MyMsgBus() {}
    
        public Initialize(string busname) // Make this part of interface    
        {
           myMsgBus = new List<string>();
    
           myIpc = CreateIpcChannel(busname);
           ChannelServices.RegisterChannel(myIpc);
    
           var entry = new WellKnownServiceTypeEntry(
              typeof(MxServeBus),
              "MyRemoteObj.rem",
              WellKnownObjectMode.Singleton);
    
           RemotingConfiguration.RegisterWellKnownServiceType(entry);
           _initialized = true;
        }
    

    In all other public methods, check for _initialized flag and throw NotInitializedException if flag is false.

    You should use it as

     IMyMsgBus lBus = (IMyMsgBus)Activator.GetObject(typeof(IMyMsgBus));
     lBus.Initialize(objUri);
     ... do Further operation
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ReSTful web service which needs to parse locale-sensitive data from the
I have a Silverlight 3 application which needs to call WCF service. The WCF
ok I have this application which needs to send periodic updates to a web-service,
I have an application which needs to accept a POST request from an outside
I have a service which takes the user supplied rich text (can have HTML
I have an interoperable WCF service which needs to provide a DateTime value to
I have a application which needs to poll data at frequent intervals. I had
I have 3rd party wcf soap service which needs to-be consume so i have
Am building a restful web service which needs to populate data (from a parsed
I have a Spring Integration application which needs to be relatively resource efficient. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.