WCF configuration file

WCF configuration file

 

The configuration file in the host application follows the same format as the configuration file in the client application. There is a <bindings> section where the bindings are defined and a <service> section in which the endpoints (addresses and bindings) are defined.

 

When defining endpoints in a configuration file the service name should be in the format of NAMESPACE.CLASSNAME, and the endpoint contract name should be in the format of NAMESPACE.INTERFACECLASS.

 

In the preceding example, the service namespace is WCFService with a class name of ServiceClass, and the interface is named IServiceClass. Therefore the service and endpoints are defined in the configuration file as the following:

 

<service name =”WCFService.ServiceClass”>

<endpoint contract =”WCFService.IServiceClass”

name=”NetTcpBinding_IServiceClass”

binding =”netTcpBinding”

address =”net.tcp://localhost:8000/TcpBinding”/>

<endpoint contract =”WCFService.IServiceClass”

name=”netNamedPipeBinding_IServiceClass”

binding =”netNamedPipeBinding”

address =”net.pipe://localhost/NetNamedPipeBinding”/>

</service>

 

 

 

posted @ 2008-01-23 18:22  Rickie  阅读(439)  评论(0编辑  收藏  举报