background preloader

Dot-net App Domains

Facebook Twitter

Inter-Process Duplex Communication with WCF Named Pipes. Named pipes enable two applications on the same windows-based physical device to communicate with each other across process boundaries.

Inter-Process Duplex Communication with WCF Named Pipes

This blog entry shows how to use WCF and the NetNamedPipeBinding to set up a duplex communication channel based on named pipes. A named pipe itself is just an object in the windows kernel. It provides access for different clients to a shared resource. A pipe is identified by its name and can be used for one-way or duplex communication scenarios. While there may be only one pipe server, there may be more than one client applications using a pipe. I created a simple example to show you the setup of two applications communicating via named pipes. [ServiceContract(SessionMode = SessionMode.Required, CallbackContract = typeof(IProductServiceCallback))] public interface IProductService [OperationContract] void RegisterForAddedProducts(); void GetProductInformation(string productNumber); The service contract contains two methods.

[OperationContract(IsOneWay = true)] .net - ServiceHost's conflict on address when unit tested. Muhammad Shujaat Siddiqi: WPF - Inter-Domain Messaging using AppDomain Slots. In this post we will discuss Named slot.

Muhammad Shujaat Siddiqi: WPF - Inter-Domain Messaging using AppDomain Slots

Slots are used for inter-domain messaging. A sender from one application domain sets the message in other application domain. Any receiver in the other domain can receive the message from the slots. Let's define a Window to demonstrate the usage of AppDomain's slot to send and receive message to the Application Domain. Instantiating Application Domain:Let's create a new application domain appDomain. AppDomain appDomain; public MainWindow(){ InitializeComponent(); appDomain = AppDomain.CreateDomain("MyNewDomain");} Sending message to Application Domain:Let's write some message in a named slot of the application domain. Private void btnSendMessage_Click(object sender, RoutedEventArgs e){ string message = this.textBoxMessage.Text; appDomain.SetData("MyMessage", message);} Receiving message in Application Domain:Now let's receive this message in the other application domain.

Let's enter some text in the Text box and hit Send Message button. Download: Pass Data Between Application Domains. You can pass data between application domains as arguments and return values when you invoke the members of objects that exist in other application domains.

Pass Data Between Application Domains

However, at times it's useful to pass data between application domains in such a way that the data is easily accessible by all code within the application domain. Every application domain maintains a data cache that contains a set of name/value pairs. Most of the cache content reflects configuration settings of the application domain, such as the values from the AppDomainSetup object provided during application domain creation. (See here for more) You can also use this data cache as a mechanism to exchange data between application domains or as a simple state storage mechanism for code running within the application domain.

The SetData method allows you to associate a string key with an object and store it in the application domain's data cache. WCF Tutorial - Basic Interprocess Communication. Journey Into Code: Interprocess Communication with WCF - Part 2. In Part 1 I showed you how you can use WCF with named pipes to send messages from a client to a server.

Journey Into Code: Interprocess Communication with WCF - Part 2

Now I will show you how we can modify that code to send messages in the other direction, from the server back to the client. We do this by creating a callback interface and referencing it in our service contract. We then implement the callback interface in our client. First things first, lets create our callback interface. In our server application add a new class file, ICallback.cs. Using System.ServiceModel;namespace Server{ public interface ICallback { [OperationContract(IsOneWay = true)] void SendMessage(string message); }} Very simple and straight forward but note we need to decorate any methods of our callback interface that we wish to expose to the server with an OperationContract attribute. Wcf named pipe two way. Mmunication between application domain using named pipes wcf. C# - Async two-way communication with Windows Named Pipes (.Net) Create a Intra-Application Named Pipe using WCF in .Net using C#; IPC Communications. « OmegaMan's Musings.

WCF Tutorial - Basic Interprocess Communication. Communicate between app domains.