Skip to content

Locating rpc services

jdmgj edited this page Aug 6, 2012 · 2 revisions

Dispatching RPC invocation to the method of the service type dependes on Dispatcher implementation. The default dispatcher is LocatorBasedDispatcher, which find target method via ServiceTypeLocator. Although the service type locator is also extensible, you may use built-in DefaultServiceTypeLocator or FileBasedServiceTypeLocator.

Service Operation Requirements

Message Pack RPC service type locator uses opt-in manner to locate service methods. The methods are valid service method when the following all conditions are true:

  • The service type which defines the service method is not abstract type. That is, the service type can be instantiated.
  • The service type is marked with MessagePackRpcServiceContractAttribute.
  • The methods on the service type which are marked with MessagePackRpcMethodAttribute are considered as service operation.

DefaultServiceTypeLocator

DefaultServiceTypeLocator locates operations with in memory dictionary. It is extremely frexible and is handy for testing purposes. It might by difficult to isolate your custom server framework and application code, however, so you want to consider using FileBasedServiceTypeLocator or custom own locator.

FileBasedServiceTypeLocator

FileBasedServiceTypeLocator locates operations with *.svc file which is compliant with WCF. Note that assemblies which contains service types must be located in any assembly probing pathes, such as application's current directory.

Available attribute on *.svc file is limited, and all unknown attributes are just ignored. You can specify only one <#@ServiceHost> element in the file.

attribute mean
Service Service type name which is fully qualified name with assembly full name.