Get Familiar With Windows Communication Application Development
By Certification Magazine —
1 | 2 | 3 | 4 | 5 |
The switch value indicates the trace level and whether activity tracing is enabled. If activity tracing is enabled, then flow events between processing activities and components will be traced, as well. The trace levels are defined as follows:
- Off: Disables tracing.
- Critical: Only the non-application negative events are traced. This includes events such as unexpected processing or error conditions.
- Error: All negative events are traced, including application-specific errors.
- Warning: All negative events and run time.
- Information: All negative and positive events are traced.
- Verbose: All negative and positive events are traced, including application-specific informational events.
- All: All events are traced.
You can use ActivityTracing to trace the activities of an application at run time. If you want to propagate the activity to the other endpoints involved in the message exchange, then you should set the propagateActivity attribute to true. When propagateActivity is set to true, the traces generated by the two endpoints can be compared to see how the traces at one endpoint flowed to the traces at another endpoint.
The propagateActivity attribute only can be set for the trace sources provided by WCF and not for the user-defined trace sources. The trace messages are collected, stored and routed by listeners. You can redirect the traces generated by the application or the service to a log, a window or a text file by using a listener. To read the trace log using the SvcTraceViewer tool, you should use the XmlWriterTraceListener class.
You should not set the switchValue attribute to the value Critical, ActivityTracing because trace-level Critical does not trace warning or positive events, required for optimization.
You should not set the name attribute of the of the source element to System.Runtime.Serialization because you need to trace all WCF processing events. You cannot set switchValue attribute to ActivityTracing with the trace source System.Runtime.Serialization.
References:
Sub-objective: Create a service proxy.
Single answer, multiple-choice
You are developing a Windows Communication Foundation (WCF) client using the Microsoft .NET 3.5 Framework. The WCF service provides updated news articles and columns from newspapers around the world.
The WCF service is hosted in a local IIS server instance with the following settings:
- Server: WcfWebServer
- VirtualDirectory: Services
- Service File: NewsService.svc
You want to generate a WCF client proxy with the least amount of developer effort. Which command-line statement should you run?
A. svcutil /l:cs /t:metadata /tcv:Version35 http://WcfWebServer/Services/NewsService.svc?wsdl
B. svcutil /l:cs /tcv:Version35 http://WcfWebServer/Services/NewsService.svc
C. svcconfigeditor /l:cs /t:metadata /tcv:Version35 http://WcfWebServer/Services/NewsService.svc?wsdl
D. svcconfigeditor /l:cs /tcv:Version35 http://WcfWebServer/Services/NewsService.svc
Answer:
B. svcutil /l:cs /tcv:Version35 http://WcfWebServer/Services/NewsService.svc
Tutorial:
To generate a WCF client proxy with the least amount of developer effort, you should use the ServiceModel Metadata Utility (Svcutil.exe) Tool as follows:
svcutil /l:cs /tcv:Version35 http://WcfWebServer/Services/NewsService.svc
This command-line statement uses the /language or /l switch to specify that WCF client code should be generated in C#. To ensure the WCF client is using the Microsoft .NET Framework version 3.5, the /tcv parameter is set to Version35. The main argument is set to the service file location http://WcfWebServer/Services/NewsService.svc. When this command-line statement is executed, the client proxy will be generated in C# using the Microsoft .NET 3.5 Framework.
The svcutil.exe utility can be used for various purposes, such as generating WCF client code, exporting metadata from client code, validating WCF service compiled code, downloading metadata from a WCF services and generating serialization code. The /target or /t switch specifies the output to be generated, while the /directory or /d switch specifies the output directory. The /out or /o switch specifies the file name of the output file. The svcutil.exe utility expects the main argument as an endpoint address, service file URL or metadata document path.
When generating a WCF client proxy, you may also use the following switches:
- /async: Generates asynchronous signatures for service operations.
- /config: Specifies the filename for configuration settings.
When exporting metadata from a WCF service, you may also use the following switches:
- /t:metadata: Specifies that WCF metadata will be generated.
- /serviceName: Specifies the service configuration name (used in probing).
- /dataContractOnly: Indicates that only data contracts will be processed, not service contracts.
To validate a WCF service code, you should specify the /validate switch. To generate serialization code for a WCF service, you should specify the /t:xmlSerializer switch.
You should not use the command-line statement that sets the /t option to metadata because this will export metadata, not a WCF client proxy.
You should not use the command-line statements that specify the svcconfigeditor.exe tool because this tool is used to generate the XML for a WCF server or client configuration file.
References:
1 | 2 | 3 | 4 | 5 |



