I am writing a simple server (publisher) and client (subscriber) application to imagine inter-process communication between two managed C# processes.
I need to write a server (that's working as a publisher) that will publish the contents to the subscriber on the basis of its subscriptions and client (subscriber). For this I have to write two seperate configuration files (app.config
) on both the publisher's and subscriber's end.
It's creating a problem. When the publisher wants to publish the data, it starts the process (client which is working as subscriber) with Process.Start
statement. On start, the client process is unable to initialize remoting because it loads app.config
which is being used on the server side, where it didn't find its own configurations (subscriber's configurations).
I need to write both subscriber and publisher configuration on a single app.config
file.
How do I go about doing this?
Are the publisher and subscriber running under the same exe? If not, then you can use application specific config files (.config) rather than "app.config".
From MSDN:
You can put the connection info here, and specify the StartInfo for the Process.Start and make sure you specify where the app is launched from. That should force it to read from the config file in that directory.