WCF uses address, binding and contract configuration elements.
AsyncWcfLib reduces the configuration burden:
Addresses may be created programmatically for service or client instances.
Default binding for all endpoints is defined in class WcfDefault.
Services and clients must use the same binding.
The binding greatly affects communication speed. Ws2007HttbBinding is 4 times slower than basicHttpBinding.
TcpBinding is used as default. HttpBinding needs port reservation under Windows 7.
Individual binding for each port may be set when calling ActorOutput.LinkOutputToRemoteService and ActorInput.LinkInputToNetwork.
Operation Contract is fixed by AsyncWcfLib:
Services and Clients use "AsyncWcfLib.Basic.IWcfBasicContractSync". This is an synchronous interface, returning a response after handling the request.
The contract may be used by partners running on .NET 3.5 - 4.5 or Mono.
The library handles the different asynchronous patterns for clients and services.
Data Contract consists of all classes used as messages. Most of them are created by the library user.
These classes are deployed in form of an assembly-dll at the client and the service side, see [AsyncWcfLib package diagram].
When using AsyncWcfLib, service and client configuration files are optional.
If you want to use an App.config file, the name "AsyncWcfLib.ServiceContract" is used for service configuration.
When using a special client configuration, the clientName (given in the constructor) is used to find the endpoint configuration in the config file.
The full service URI is assembled from the following components:
In order to lookup ActorInputs by WcfRouter, each ActorInputName must be unique in a plant.
Actors may be moved from one host to another or may be moved from one application into another. Clients will automatically discover the moved actors because a lookup at the router will return the correct URI containing hostname and TCP port.
ActorOutput identification is used to identify the connected client by the service.
Using the ActorOutput identification, the service is able to match newly connected clients to their client state before a network communication interrupt.
It is also used to trace(log) source and destination of message exchange.
The unique identification of an ActorOutput contains some of the following components:
The following three session modes are used for applications containing actors.
The session mode defines the level of recovery after connection loss.
It also defines the name of the tracefile written by class WcfTrcPluginFile.
Used e.g. for graphical user interfaces.
The application instance number must be set to 0. Change the implementation of WcfDefault.IsProcessIdUsed to adapt this behaviour to your own needs.
Upon disconnect the session data is disposed on the service side. Therefore no recovery is possible after unexpected network interrupts.
ActorOutput identification:
Tracefilename:
When the application instance number is below 100, the number must be unique on the host only, not the whole plant.
Change the implementation of WcfDefault.IsAppIdUniqueInPlant to adapt this behaviour to your own needs.
If you will, data referencing the partner actor may be kept even when the connection is disconnected or the partner has shut down.
After restart of clients, services or hosts, the original partner is mapped to its session data in the still running actor.
ActorOutput identification:
Tracefilename:
A plantwide unique application instance number may be advantageous in some cases (e.g. central, host independent configuration).
In this mode AsyncWcfLib supports backup applications having same application instance number but running on seperate hosts.
The backup application reclaims connection and state after shutdown of the first application (-host).
As the hostname is not part of the ActorOutput identification, the backup actor may take over at the state, where the failed actor has left the still running partner.
ActorOutput identification:
Tracefilename:
Wiki: Actors
Wiki: AsyncWcfLib package diagram
Wiki: Home
Wiki: Implement a client using AsyncWcfLib
Wiki: Implement a service using AsyncWcfLib
Wiki: Run AsyncWcfLib.Test1
Wiki: Run AsyncWcfLib.Test2
Wiki: Run AsyncWcfLib.Test3