34

2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand [email protected] SOA315

Embed Size (px)

Citation preview

Page 1: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

2

Productive Windows Communication Foundation

Jeremy BoydMindscapeMSDN Regional Director ndash New Zealandjeremymindscapeconz

SOA315

3

Legends

Juval Lowy ndash Regional Director Silicon Valley

Christian Weyer ndash Regional Director Germany

4

Agenda

Some useful toolsUnit Testing Services using In Process HostingPer operation scoped extensionsTips around Data ContractsManaging FaultsWindows Forms and WCFHosting services under IIS 7

5

Useful Tools

A number of useful tools were provided with NET 30

SvcTraceViewerSvcConfigEditor

New tools with NET 35Service Test HostService Test Client

6

Sample Test HostUseful Tools

NET 35 ships with simple generic hostWcfSvcHostexe

Must provide as command line argumentsService class assembly

Class library or application assembly Config file (may be separate from normal)Can optionally start a test client at the same time

7

Sample Test ClientUseful Tools

NET 35 ships with simple generic test clientWcfTestClientexe

Must provide service metadata as command line arguments

Eg WcfTestClient httpserverporturl

8

Useful Tools

demo

9

Extra TipsUseful Tools

Can host within Visual Studio for F5rsquoing by using ldquoStart External Programrdquo

Can also have it call to the WcfTestClient

Can use with WCF 30 and Visual Studio 2005 if required ndash just add WcfSvcHost to the GAC

10

Unit Testing with Services

Testing Service Classes is no problemCreate class and invoke methods

Testing classes with dependencies on services is a problem

Should ideally remove dependenciesWhat if execution context matters

11

Hosting In-Process

Need a simple way to host a service in-process so we can simulate the WCF pipelineWant to support security transaction flow etcIdeally avoid any ldquoimplementationrdquo code

Proxy implementationConfig filesServiceHost wrapper

12

Hosting In-Process

demo

13

Per Operation Scope Extensions

Use an IDispatchMessageInspector to deal with ldquoper callrdquo concerns

Use an IServiceBehavior to apply the message inspector

I personally favour an attribute based approach

Add and reference your extensions from OperationContextCurrentExtensions

14

Tips for Data Contracts

General issues withWorking with OO mismatchesWorking with DataTables DataSetsDTO construction

Some useful advancements in 35 SP1Automatic support for graph serializationPOCO support for serialization

15

Operations Overloading Tips for Data Contracts

Cannot overload operations with services Can manually enable overloading

Use Name property to alias overloaded operations on service Generate proxy on client sideRename proxy methods to generate overloading Use Name property to alias overloaded methods on proxyMake calls on internal channel using the overloaded methods

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 2: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

3

Legends

Juval Lowy ndash Regional Director Silicon Valley

Christian Weyer ndash Regional Director Germany

4

Agenda

Some useful toolsUnit Testing Services using In Process HostingPer operation scoped extensionsTips around Data ContractsManaging FaultsWindows Forms and WCFHosting services under IIS 7

5

Useful Tools

A number of useful tools were provided with NET 30

SvcTraceViewerSvcConfigEditor

New tools with NET 35Service Test HostService Test Client

6

Sample Test HostUseful Tools

NET 35 ships with simple generic hostWcfSvcHostexe

Must provide as command line argumentsService class assembly

Class library or application assembly Config file (may be separate from normal)Can optionally start a test client at the same time

7

Sample Test ClientUseful Tools

NET 35 ships with simple generic test clientWcfTestClientexe

Must provide service metadata as command line arguments

Eg WcfTestClient httpserverporturl

8

Useful Tools

demo

9

Extra TipsUseful Tools

Can host within Visual Studio for F5rsquoing by using ldquoStart External Programrdquo

Can also have it call to the WcfTestClient

Can use with WCF 30 and Visual Studio 2005 if required ndash just add WcfSvcHost to the GAC

10

Unit Testing with Services

Testing Service Classes is no problemCreate class and invoke methods

Testing classes with dependencies on services is a problem

Should ideally remove dependenciesWhat if execution context matters

11

Hosting In-Process

Need a simple way to host a service in-process so we can simulate the WCF pipelineWant to support security transaction flow etcIdeally avoid any ldquoimplementationrdquo code

Proxy implementationConfig filesServiceHost wrapper

12

Hosting In-Process

demo

13

Per Operation Scope Extensions

Use an IDispatchMessageInspector to deal with ldquoper callrdquo concerns

Use an IServiceBehavior to apply the message inspector

I personally favour an attribute based approach

Add and reference your extensions from OperationContextCurrentExtensions

14

Tips for Data Contracts

General issues withWorking with OO mismatchesWorking with DataTables DataSetsDTO construction

Some useful advancements in 35 SP1Automatic support for graph serializationPOCO support for serialization

15

Operations Overloading Tips for Data Contracts

Cannot overload operations with services Can manually enable overloading

Use Name property to alias overloaded operations on service Generate proxy on client sideRename proxy methods to generate overloading Use Name property to alias overloaded methods on proxyMake calls on internal channel using the overloaded methods

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 3: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

4

Agenda

Some useful toolsUnit Testing Services using In Process HostingPer operation scoped extensionsTips around Data ContractsManaging FaultsWindows Forms and WCFHosting services under IIS 7

5

Useful Tools

A number of useful tools were provided with NET 30

SvcTraceViewerSvcConfigEditor

New tools with NET 35Service Test HostService Test Client

6

Sample Test HostUseful Tools

NET 35 ships with simple generic hostWcfSvcHostexe

Must provide as command line argumentsService class assembly

Class library or application assembly Config file (may be separate from normal)Can optionally start a test client at the same time

7

Sample Test ClientUseful Tools

NET 35 ships with simple generic test clientWcfTestClientexe

Must provide service metadata as command line arguments

Eg WcfTestClient httpserverporturl

8

Useful Tools

demo

9

Extra TipsUseful Tools

Can host within Visual Studio for F5rsquoing by using ldquoStart External Programrdquo

Can also have it call to the WcfTestClient

Can use with WCF 30 and Visual Studio 2005 if required ndash just add WcfSvcHost to the GAC

10

Unit Testing with Services

Testing Service Classes is no problemCreate class and invoke methods

Testing classes with dependencies on services is a problem

Should ideally remove dependenciesWhat if execution context matters

11

Hosting In-Process

Need a simple way to host a service in-process so we can simulate the WCF pipelineWant to support security transaction flow etcIdeally avoid any ldquoimplementationrdquo code

Proxy implementationConfig filesServiceHost wrapper

12

Hosting In-Process

demo

13

Per Operation Scope Extensions

Use an IDispatchMessageInspector to deal with ldquoper callrdquo concerns

Use an IServiceBehavior to apply the message inspector

I personally favour an attribute based approach

Add and reference your extensions from OperationContextCurrentExtensions

14

Tips for Data Contracts

General issues withWorking with OO mismatchesWorking with DataTables DataSetsDTO construction

Some useful advancements in 35 SP1Automatic support for graph serializationPOCO support for serialization

15

Operations Overloading Tips for Data Contracts

Cannot overload operations with services Can manually enable overloading

Use Name property to alias overloaded operations on service Generate proxy on client sideRename proxy methods to generate overloading Use Name property to alias overloaded methods on proxyMake calls on internal channel using the overloaded methods

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 4: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

5

Useful Tools

A number of useful tools were provided with NET 30

SvcTraceViewerSvcConfigEditor

New tools with NET 35Service Test HostService Test Client

6

Sample Test HostUseful Tools

NET 35 ships with simple generic hostWcfSvcHostexe

Must provide as command line argumentsService class assembly

Class library or application assembly Config file (may be separate from normal)Can optionally start a test client at the same time

7

Sample Test ClientUseful Tools

NET 35 ships with simple generic test clientWcfTestClientexe

Must provide service metadata as command line arguments

Eg WcfTestClient httpserverporturl

8

Useful Tools

demo

9

Extra TipsUseful Tools

Can host within Visual Studio for F5rsquoing by using ldquoStart External Programrdquo

Can also have it call to the WcfTestClient

Can use with WCF 30 and Visual Studio 2005 if required ndash just add WcfSvcHost to the GAC

10

Unit Testing with Services

Testing Service Classes is no problemCreate class and invoke methods

Testing classes with dependencies on services is a problem

Should ideally remove dependenciesWhat if execution context matters

11

Hosting In-Process

Need a simple way to host a service in-process so we can simulate the WCF pipelineWant to support security transaction flow etcIdeally avoid any ldquoimplementationrdquo code

Proxy implementationConfig filesServiceHost wrapper

12

Hosting In-Process

demo

13

Per Operation Scope Extensions

Use an IDispatchMessageInspector to deal with ldquoper callrdquo concerns

Use an IServiceBehavior to apply the message inspector

I personally favour an attribute based approach

Add and reference your extensions from OperationContextCurrentExtensions

14

Tips for Data Contracts

General issues withWorking with OO mismatchesWorking with DataTables DataSetsDTO construction

Some useful advancements in 35 SP1Automatic support for graph serializationPOCO support for serialization

15

Operations Overloading Tips for Data Contracts

Cannot overload operations with services Can manually enable overloading

Use Name property to alias overloaded operations on service Generate proxy on client sideRename proxy methods to generate overloading Use Name property to alias overloaded methods on proxyMake calls on internal channel using the overloaded methods

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 5: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

6

Sample Test HostUseful Tools

NET 35 ships with simple generic hostWcfSvcHostexe

Must provide as command line argumentsService class assembly

Class library or application assembly Config file (may be separate from normal)Can optionally start a test client at the same time

7

Sample Test ClientUseful Tools

NET 35 ships with simple generic test clientWcfTestClientexe

Must provide service metadata as command line arguments

Eg WcfTestClient httpserverporturl

8

Useful Tools

demo

9

Extra TipsUseful Tools

Can host within Visual Studio for F5rsquoing by using ldquoStart External Programrdquo

Can also have it call to the WcfTestClient

Can use with WCF 30 and Visual Studio 2005 if required ndash just add WcfSvcHost to the GAC

10

Unit Testing with Services

Testing Service Classes is no problemCreate class and invoke methods

Testing classes with dependencies on services is a problem

Should ideally remove dependenciesWhat if execution context matters

11

Hosting In-Process

Need a simple way to host a service in-process so we can simulate the WCF pipelineWant to support security transaction flow etcIdeally avoid any ldquoimplementationrdquo code

Proxy implementationConfig filesServiceHost wrapper

12

Hosting In-Process

demo

13

Per Operation Scope Extensions

Use an IDispatchMessageInspector to deal with ldquoper callrdquo concerns

Use an IServiceBehavior to apply the message inspector

I personally favour an attribute based approach

Add and reference your extensions from OperationContextCurrentExtensions

14

Tips for Data Contracts

General issues withWorking with OO mismatchesWorking with DataTables DataSetsDTO construction

Some useful advancements in 35 SP1Automatic support for graph serializationPOCO support for serialization

15

Operations Overloading Tips for Data Contracts

Cannot overload operations with services Can manually enable overloading

Use Name property to alias overloaded operations on service Generate proxy on client sideRename proxy methods to generate overloading Use Name property to alias overloaded methods on proxyMake calls on internal channel using the overloaded methods

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 6: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

7

Sample Test ClientUseful Tools

NET 35 ships with simple generic test clientWcfTestClientexe

Must provide service metadata as command line arguments

Eg WcfTestClient httpserverporturl

8

Useful Tools

demo

9

Extra TipsUseful Tools

Can host within Visual Studio for F5rsquoing by using ldquoStart External Programrdquo

Can also have it call to the WcfTestClient

Can use with WCF 30 and Visual Studio 2005 if required ndash just add WcfSvcHost to the GAC

10

Unit Testing with Services

Testing Service Classes is no problemCreate class and invoke methods

Testing classes with dependencies on services is a problem

Should ideally remove dependenciesWhat if execution context matters

11

Hosting In-Process

Need a simple way to host a service in-process so we can simulate the WCF pipelineWant to support security transaction flow etcIdeally avoid any ldquoimplementationrdquo code

Proxy implementationConfig filesServiceHost wrapper

12

Hosting In-Process

demo

13

Per Operation Scope Extensions

Use an IDispatchMessageInspector to deal with ldquoper callrdquo concerns

Use an IServiceBehavior to apply the message inspector

I personally favour an attribute based approach

Add and reference your extensions from OperationContextCurrentExtensions

14

Tips for Data Contracts

General issues withWorking with OO mismatchesWorking with DataTables DataSetsDTO construction

Some useful advancements in 35 SP1Automatic support for graph serializationPOCO support for serialization

15

Operations Overloading Tips for Data Contracts

Cannot overload operations with services Can manually enable overloading

Use Name property to alias overloaded operations on service Generate proxy on client sideRename proxy methods to generate overloading Use Name property to alias overloaded methods on proxyMake calls on internal channel using the overloaded methods

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 7: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

8

Useful Tools

demo

9

Extra TipsUseful Tools

Can host within Visual Studio for F5rsquoing by using ldquoStart External Programrdquo

Can also have it call to the WcfTestClient

Can use with WCF 30 and Visual Studio 2005 if required ndash just add WcfSvcHost to the GAC

10

Unit Testing with Services

Testing Service Classes is no problemCreate class and invoke methods

Testing classes with dependencies on services is a problem

Should ideally remove dependenciesWhat if execution context matters

11

Hosting In-Process

Need a simple way to host a service in-process so we can simulate the WCF pipelineWant to support security transaction flow etcIdeally avoid any ldquoimplementationrdquo code

Proxy implementationConfig filesServiceHost wrapper

12

Hosting In-Process

demo

13

Per Operation Scope Extensions

Use an IDispatchMessageInspector to deal with ldquoper callrdquo concerns

Use an IServiceBehavior to apply the message inspector

I personally favour an attribute based approach

Add and reference your extensions from OperationContextCurrentExtensions

14

Tips for Data Contracts

General issues withWorking with OO mismatchesWorking with DataTables DataSetsDTO construction

Some useful advancements in 35 SP1Automatic support for graph serializationPOCO support for serialization

15

Operations Overloading Tips for Data Contracts

Cannot overload operations with services Can manually enable overloading

Use Name property to alias overloaded operations on service Generate proxy on client sideRename proxy methods to generate overloading Use Name property to alias overloaded methods on proxyMake calls on internal channel using the overloaded methods

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 8: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

9

Extra TipsUseful Tools

Can host within Visual Studio for F5rsquoing by using ldquoStart External Programrdquo

Can also have it call to the WcfTestClient

Can use with WCF 30 and Visual Studio 2005 if required ndash just add WcfSvcHost to the GAC

10

Unit Testing with Services

Testing Service Classes is no problemCreate class and invoke methods

Testing classes with dependencies on services is a problem

Should ideally remove dependenciesWhat if execution context matters

11

Hosting In-Process

Need a simple way to host a service in-process so we can simulate the WCF pipelineWant to support security transaction flow etcIdeally avoid any ldquoimplementationrdquo code

Proxy implementationConfig filesServiceHost wrapper

12

Hosting In-Process

demo

13

Per Operation Scope Extensions

Use an IDispatchMessageInspector to deal with ldquoper callrdquo concerns

Use an IServiceBehavior to apply the message inspector

I personally favour an attribute based approach

Add and reference your extensions from OperationContextCurrentExtensions

14

Tips for Data Contracts

General issues withWorking with OO mismatchesWorking with DataTables DataSetsDTO construction

Some useful advancements in 35 SP1Automatic support for graph serializationPOCO support for serialization

15

Operations Overloading Tips for Data Contracts

Cannot overload operations with services Can manually enable overloading

Use Name property to alias overloaded operations on service Generate proxy on client sideRename proxy methods to generate overloading Use Name property to alias overloaded methods on proxyMake calls on internal channel using the overloaded methods

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 9: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

10

Unit Testing with Services

Testing Service Classes is no problemCreate class and invoke methods

Testing classes with dependencies on services is a problem

Should ideally remove dependenciesWhat if execution context matters

11

Hosting In-Process

Need a simple way to host a service in-process so we can simulate the WCF pipelineWant to support security transaction flow etcIdeally avoid any ldquoimplementationrdquo code

Proxy implementationConfig filesServiceHost wrapper

12

Hosting In-Process

demo

13

Per Operation Scope Extensions

Use an IDispatchMessageInspector to deal with ldquoper callrdquo concerns

Use an IServiceBehavior to apply the message inspector

I personally favour an attribute based approach

Add and reference your extensions from OperationContextCurrentExtensions

14

Tips for Data Contracts

General issues withWorking with OO mismatchesWorking with DataTables DataSetsDTO construction

Some useful advancements in 35 SP1Automatic support for graph serializationPOCO support for serialization

15

Operations Overloading Tips for Data Contracts

Cannot overload operations with services Can manually enable overloading

Use Name property to alias overloaded operations on service Generate proxy on client sideRename proxy methods to generate overloading Use Name property to alias overloaded methods on proxyMake calls on internal channel using the overloaded methods

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 10: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

11

Hosting In-Process

Need a simple way to host a service in-process so we can simulate the WCF pipelineWant to support security transaction flow etcIdeally avoid any ldquoimplementationrdquo code

Proxy implementationConfig filesServiceHost wrapper

12

Hosting In-Process

demo

13

Per Operation Scope Extensions

Use an IDispatchMessageInspector to deal with ldquoper callrdquo concerns

Use an IServiceBehavior to apply the message inspector

I personally favour an attribute based approach

Add and reference your extensions from OperationContextCurrentExtensions

14

Tips for Data Contracts

General issues withWorking with OO mismatchesWorking with DataTables DataSetsDTO construction

Some useful advancements in 35 SP1Automatic support for graph serializationPOCO support for serialization

15

Operations Overloading Tips for Data Contracts

Cannot overload operations with services Can manually enable overloading

Use Name property to alias overloaded operations on service Generate proxy on client sideRename proxy methods to generate overloading Use Name property to alias overloaded methods on proxyMake calls on internal channel using the overloaded methods

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 11: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

12

Hosting In-Process

demo

13

Per Operation Scope Extensions

Use an IDispatchMessageInspector to deal with ldquoper callrdquo concerns

Use an IServiceBehavior to apply the message inspector

I personally favour an attribute based approach

Add and reference your extensions from OperationContextCurrentExtensions

14

Tips for Data Contracts

General issues withWorking with OO mismatchesWorking with DataTables DataSetsDTO construction

Some useful advancements in 35 SP1Automatic support for graph serializationPOCO support for serialization

15

Operations Overloading Tips for Data Contracts

Cannot overload operations with services Can manually enable overloading

Use Name property to alias overloaded operations on service Generate proxy on client sideRename proxy methods to generate overloading Use Name property to alias overloaded methods on proxyMake calls on internal channel using the overloaded methods

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 12: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

13

Per Operation Scope Extensions

Use an IDispatchMessageInspector to deal with ldquoper callrdquo concerns

Use an IServiceBehavior to apply the message inspector

I personally favour an attribute based approach

Add and reference your extensions from OperationContextCurrentExtensions

14

Tips for Data Contracts

General issues withWorking with OO mismatchesWorking with DataTables DataSetsDTO construction

Some useful advancements in 35 SP1Automatic support for graph serializationPOCO support for serialization

15

Operations Overloading Tips for Data Contracts

Cannot overload operations with services Can manually enable overloading

Use Name property to alias overloaded operations on service Generate proxy on client sideRename proxy methods to generate overloading Use Name property to alias overloaded methods on proxyMake calls on internal channel using the overloaded methods

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 13: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

14

Tips for Data Contracts

General issues withWorking with OO mismatchesWorking with DataTables DataSetsDTO construction

Some useful advancements in 35 SP1Automatic support for graph serializationPOCO support for serialization

15

Operations Overloading Tips for Data Contracts

Cannot overload operations with services Can manually enable overloading

Use Name property to alias overloaded operations on service Generate proxy on client sideRename proxy methods to generate overloading Use Name property to alias overloaded methods on proxyMake calls on internal channel using the overloaded methods

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 14: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

15

Operations Overloading Tips for Data Contracts

Cannot overload operations with services Can manually enable overloading

Use Name property to alias overloaded operations on service Generate proxy on client sideRename proxy methods to generate overloading Use Name property to alias overloaded methods on proxyMake calls on internal channel using the overloaded methods

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 15: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

16

Datasets and Tables Tips for Data Contracts

ADONET makes using DataSet and DataTable easy (too easy)Consider implications of passing dataset and data table

Inside layers of app probably fine Consider implications of publishing schema

Across technology boundaries consider returning arrays or other neutral representation

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 16: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

17

Tips for Data Contracts

demo

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 17: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

18

Fault Debugging

Two main desires for debuggingProviding detail of errors or exceptionsFlowing exceptions back to clients

Remember to use tracing informationExisting SDK tools help with this

SvcConfigEditorSvcTraceViewer

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 18: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

19

Providing Exception Details Fault Debugging

By default WCF will mask service exceptions Service exceptions returned as FaultExceptionThis is best practice (donrsquot leak)

However sometimes this is needed or usefulIncludeExceptionDetailInFaults property of ServiceBehavior attribute

Defaults to false Should only use in ldquodebugrdquo mode

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 19: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

20

Flowing Exceptions to the ClientFault Debugging

When debugging it is useful to flow exceptions

FaultExceptionltExceptionDetailgt class in the ServiceModel framework already caters for this

Initialized with original exceptionDetailType contains name of service exceptionMessage contains original exception message

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 20: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

21

Managing Faults

demo

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 21: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

22

Windows Forms and WCF

Form itself can be a serviceSimplifies reaching into the formSelf-hostedSubscriber to update events

Form needs to be a singletonUse InstanceContextModeSingle

Can get a bit messy to manage UI updates however

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 22: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

23

Windows Forms and WCF

demo

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 23: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

24

Hosting with IIS 7

Self HostedProcess

W3SVC

NET Worker

Service Host

HTTP

NETTCP

NETPIPE

NETM

SMQ

WAS

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 24: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

25

Hosting with IIS 7 WAS

demo

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 25: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

26

Configuration

Expose metadata at least on your test instancesSupports test clients and easier development

Look to understand and tweak bindings to suit requirements eg Security Transaction modes and Throttling

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 26: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

27

Throttling

Number of out of the box defaults for throttlingSessions 10Calls 16Instances 10

ldquoLimits We dont need no stinkin limitsrdquo

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 27: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

28

Managing the Throttle

demo

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 28: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

29

Summary

Useful ToolsSample Test Host and Client

Hosting In-ProcessInProcFactory pattern simplifies life

Per Operation ExtensionsData Contract tips

Overloading using Name on OperationContractEasier DTOs using NET 35 extensions

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 29: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

30

Summary

Fault DebuggingLeverage ExceptionDetail and flowing for debuggingRemember to switch off for release

Hosting inside Windows FormsFormHostltTgt pattern works quite well

Hosting under IIS 7 WASIIS 7 can host HTTP(s) TCP Named Pipes MSMQRemember to enable the protocolRemember to define the appropriate endpoints

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 30: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

31

Resources

Programming WCF ServicesJuval Lowy OReilly 2007

httpwwwidesignnetCode libraryCoding standards

My detailsjeremymindscapeconzhttpturtlenetnzblog

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 31: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

32

Q amp A

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 32: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

33

Resources

wwwmicrosoftcomteched TechmiddotTalks TechmiddotEd BloggersLive Simulcasts Virtual Labs

httpmicrosoftcomtechnet

Evaluation licenses pre-released products and MORE

httpmicrosoftcommsdn

Developerrsquos Kit Licenses and MORE

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34
Page 33: 2 Productive Windows Communication Foundation Jeremy Boyd Mindscape MSDN Regional Director – New Zealand jeremy@mindscape.co.nz SOA315

34

copy 2008 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor other countriesThe information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation Because Microsoft must respond to changing market conditions it should not be interpreted to be a commitment on the part of Microsoft and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation MICROSOFT MAKES NO WARRANTIES EXPRESS IMPLIED

OR STATUTORY AS TO THE INFORMATION IN THIS PRESENTATION

  • Slide 1
  • Productive Windows Communication Foundation
  • Legends
  • Agenda
  • Useful Tools
  • Sample Test Host Useful Tools
  • Sample Test Client Useful Tools
  • Useful Tools (2)
  • Extra Tips Useful Tools
  • Unit Testing with Services
  • Hosting In-Process
  • Hosting In-Process (2)
  • Per Operation Scope Extensions
  • Tips for Data Contracts
  • Operations Overloading Tips for Data Contracts
  • Datasets and Tables Tips for Data Contracts
  • Tips for Data Contracts (2)
  • Fault Debugging
  • Providing Exception Details Fault Debugging
  • Flowing Exceptions to the Client Fault Debugging
  • Managing Faults
  • Windows Forms and WCF
  • Windows Forms and WCF (2)
  • Hosting with IIS 7
  • Hosting with IIS 7 WAS
  • Configuration
  • Throttling
  • Managing the Throttle
  • Summary
  • Summary (2)
  • Resources
  • Slide 32
  • Resources (2)
  • Slide 34