Who here has heard of WCF? Who here has used WCF? XML webservices? Who can tell me what SOAP stands for? Who has used RESTful webservices? Who can tell me what REST stands for?
ABCs define an “endpoint” – at a minimum the URI, port and binding of a service. Address is the URL and port. Binding is the transport protocol: http, https, net.tcp, etc. Contract is the contract, or interface, of the service being consumed.
IIS – ASP.NET-hosted .svc files; fileless activation WAS – message-based activation (RESTful URLs; MVC?) Show self-hosting/service hosting? Show WCF as ASMX trick? Show .svc consumed by plain web/AJAX clients (AspNetCompatibility)
YMMV on paths.
Enable metadata on previous configuration-less example. Browse by web. Create WcfTestClient client, invoke. Disable metadata. Browse by web. Invoke by client.
One of the trickier things with WCF, especially pre-4.0, is the complexity of configuration files. SvcConfigEditor makes it fairly simple to validate services, clients, behaviors & etc. as you add them through a GUI.
Show 3.5 config.
Show configuration-less .svc deployment in 4.0.
i.e. Mex is always IMetadataExchange Mex EndpointA standard endpoint that is used to expose service metadata. AnnouncementEndpointA standard endpoint that is used by services to send announcement messages. DiscoveryEndpointA standard endpoint that is used by services to send discovery messages. UdpDiscoveryEndpointA standard endpoint that is pre-configured for discovery operations over a UDP multicast binding. UdpAnnouncementEndpointA standard endpoint that is used by services to send announcement messages over a UDP binding. DynamicEndpointA standard endpoint that uses WS-Discovery to find the endpoint address dynamically at runtime. ServiceMetadataEndpointA standard endpoint for metadata exchange. WebHttpEndpointA standard endpoint with a WebHttpBinding binding that automatically adds the WebHttpBehavior behavior WebScriptEndpointA standard endpoint with a WebHttpBinding binding that automatically adds the WebScriptEnablingBehavior behavior. WebServiceEndpointA standard endpoint with a WebHttpBinding binding. WorkflowControlEndpointA standard endpoint that enables you to call control operations on workflow instances. WorkflowHostingEndpointA standard endpoint that supports workflow creation and bookmark resumption.
Is everyone familiar with WCF endpoint behaviors? Allows control of exception detail in error responses, service metadata, service discovery, timeouts, packet size and throttling for services and clients, myriad other facets of client and service behaviors.
Default behavior applies to any defined service that does not explicitly specify another behavior. Note: the configuration editor tool from the SDK does not appear to like empty name or null name values.
Default protocol mapping order is defined machine.config; can be overridden in machine.config, app.config, web.config. Default order in machine.config begins with basicHttp.
All SOAP – all metadata is XML, found throughout the messaging actions.
Discovery criteria include contract types, binding elements, namespace, scope, and keywords or version numbers
To find a service, clients send a Probe request that contains specific criteria such as service contract type, keywords, and scope on the network. Services receive the Probe request and determine whether they match the criteria. If a service matches, it responds by sending aProbeMatch message back to the client with the information necessary to contact the service. Clients can also send Resolve requests that allow them to find services that may have changed their endpoint address. Matching services respond to Resolve requests by sending a ResolveMatch message back to the client.
Work through Exercises 4-6; show next slide – Tracing – while work-in-progress.
Show trace(s) on UDP discovery while working through Exercises 4-6.
Utilizes a discovery proxy (dp).
Ad hoc and managed will exhibit different network traffic behaviors, so one or the other may be more appropriate or provide better results in various scenarios. (P2P vs. client-server with failover, etc.)
Up to the developer to understand the needs of their system; network profiling is a good tool.
Work through Exercise 7.
Generic, configurable SOAP intermediary. Updatable router config without service restart. Content-based XPath-driven routing.
Do Exercise 8. Note – name “RouterService” needs to be “CalculatorService” for client to call the router service. Comment out net.tcp endpoint.
Talk about failover
Do Exercise 10.
Show service, network? traces from failover
Demo fileless activation
Do REST Lab 1.
Do REST Lab 2.
Show WCF REST Service Template using routes instead of URL Rewrite.
WCF in .NET 4.0 - TVUG November 2010
Tech Valley .NET User Group
Andy Badera firstname.lastname@example.org
Client Services, Apprenda, Inc.
WCF in .NET 4.0
Discovery, failover, bridging &
APPRENDA & SAASGRID
VC-backed ($6.5M) startup in Clifton Park – hiring!
Scalable SaaS-enablement platform & WCF grid for .NET
Transform single tenant apps -> multitenant
We reduce your time to market/revenue
Heavy manipulation of WCF configuration
Inject endpoints for grid awareness/participation
Inject behaviors for session management and