16
2014 WCF Configuration The basics

WCF Configuration - The basics

Embed Size (px)

DESCRIPTION

This presentation describes the most common WCF configuration sections and how they are organized

Citation preview

Page 1: WCF Configuration - The basics

2014

WCF ConfigurationThe basics

Page 2: WCF Configuration - The basics

2

The most important thing to remember about WCF services is just as simple as…

Page 3: WCF Configuration - The basics

3

Address: Service’s URI

Binding: Specifies transports (HTTP, TCP …) and protocols (Security, Reliability …)

Contract: Interface that defines the contract

Page 4: WCF Configuration - The basics

4

Major Sections of the Configuration File-- Server Side --

<configuration> <system.serviceModel> <services>

<endpoint></endpoint>

</services><bindings>

</bindings><behaviors>

</behaviors> </system.serviceModel></configuration>

Page 5: WCF Configuration - The basics

5

<services> element• Contains all services the application hosts

<servicesname=“<Complete Namespace>.OfferService”behaviorConfiguration=“OfferManagerServiceBehavior” >

<endpointaddress=“net.tcp://localhost:808/OfferManager.dev/OfferService.svc”binding=“netTcpBinding”contract=“<Complete Namespace>.IOfferManager”bindingConfiguration=“netTcpBinding”>

</endpoint></services>

[This section is optional: a set of default endpoints are automatically added to your service]

Page 6: WCF Configuration - The basics

6

<binding> element• contains the specifications for all bindings that can be used by endpoints• system provided or custom

<bindingsname=“netTcpBinding”

portSharingEnabled="true" maxBufferSize="65536000" maxConnections="100" maxReceivedMessageSize="65536000“…

<Security mode="Transport" /></bindings >

[This section is optional]

Page 7: WCF Configuration - The basics

7

<behaviors> element• elements that define the behaviors for a service or endpoint

<behaviors><serviceBehaviors>

<behavior name="OfferManagerServiceBehavior"><serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true"/>

</behavior></serviceBehaviors>

<endpointBehaviors><behavior name="myBehavior">

<callbackDebug includeExceptionDetailInFaults="true" />

</behavior></endpointBehaviors>

</behaviors>[This section is optional]

Page 8: WCF Configuration - The basics

8

Demo• Open Visual Studio and create a new WCF project

• Edit the Web.Config file and remove all the <system.serviceModel> section• Right click on the created SVC and select « View in browser »

• It will work!

Page 9: WCF Configuration - The basics

9

WCFConfiguration Editor

Page 10: WCF Configuration - The basics

10

WCFConfiguration Editor

Page 11: WCF Configuration - The basics

11

Major Sections of the Configuration File-- Client Side --

• At Betclic, no client side service configuration is needed because we’re using a PeerToPeer WCF library based on a service directory. Client side code looks like that one:

IAlertServices srv = Locator.GetProxy<IAlertServices>();

• But if you need a client side configuration, just use: the WCFConfigurator Editor!

(turn the page to see how)

Page 12: WCF Configuration - The basics

12

WCFConfiguration Editor – Client configuration - Demo

• Open Visual Studio and create an empty web application

• Edit the Web.Config file with the WCFConfigurator editor (see slide#9)

• On the left pane (Config) Select « Client » and click on « Create a new client…»

• Choose the manual creation mode and select the service assembly from which you want to create a client

• Go through the wizard and you should have the right configuration in your Web.Config file!

Page 14: WCF Configuration - The basics

Find out more

• On https://techblog.betclicgroup.com/

Page 15: WCF Configuration - The basics

We want our Sports betting, Poker, Horse racing and Casino & Games brands to be easy to use for every gamer around the world. Code with us to make that happen.

Look at all the challenges we offer HERE

We’re hiring !

Check our Employer Page

Follow us on LinkedIn

Page 16: WCF Configuration - The basics

About Us• Betclic Everest Group, one of the world leaders in online

gaming, has a unique portfolio comprising various complementary international brands: Betclic, Everest, Bet-at-home.com, Expekt, Monte-Carlo Casino…

• Through our brands, Betclic Everest Group places expertise, technological know-how and security at the heart of our strategy to deliver an on-line gaming offer attuned to the passion of our players. We want our brands to be easy to use for every gamer around the world. We’re building our company to make that happen.

• Active in 100 countries with more than 12 million customers worldwide, the Group is committed to promoting secure and responsible gaming and is a member of several international professional associations including the EGBA (European Gaming and Betting Association) and the ESSA (European Sports Security Association).