Monday, March 24, 2014

Basic Elements of WCF Appconfig

All config items should be inside ,

<system.serviceModel>

This is the WCF namespace provided by Microsoft.

Inside the <system.serviceModel> element you have the <services> element. This is where you configure all your services.
For each service you have a <service> element inside <services> element.
A particular service can be exposed using more than one endpoint. (Ex: http , net.tcp etc)
So for each endpoint in a service you configure a <endpoint> element.
An endpoint element will have three essential things,

  1. address
  2. binding
  3. contract  
Here is a  sample config (not complete) to get an idea.

The service name is HelloService (class and namespace both are HelloService) and has two endpoints (http and net.tcp) for the service.


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="HelloService.HelloService">
        <endpoint address="HelloService" binding="basicHttpBinding" contract="HelloService.IHelloService">
        </endpoint>
        <endpoint address="HelloService" binding="netTcpBinding" contract="HelloService.IHelloService">
        </endpoint>
      </service>
    </services>
  </system.serviceModel>
</configuration>

Related Posts:

  • Basic Elements of WCF Appconfig All config items should be inside , <system.serviceModel> This is the WCF namespace provided by Microsoft. Inside the <system.serviceModel> element you have the <services> element. This is where… Read More
  • ServiceContract Name property WCFThis property can give your contract a name which is different from the actual interface name. So this way if you decide to change the interface name of a already running WCF service your client wont break. Ex:  [Servi… Read More
  • An unsecured or incorrectly fault error WCFI encountered this error while executing the following snippet, factory.CreateChannel().Issue(rst)       // Here the rst is a RequestSecurityToken object and             … Read More
  • DataContract vs Serializable WCFWhen applied to a class Serializable attribute serializes everything inside of it including private fields thus the developer has no control as what to expose. When DataContract attribute is applied to a class it will serial… Read More

0 comments:

Post a Comment