Taking some mandatory time off for system maintenance and upgrading grew into deciding that the time was right to make the arrangement more permanent. That was probably apparent a few weeks ago but officially now the 1,111th post here is also the last one.
I’m done but there’s still plenty more to say about WCF. For continued news and updates at least try the Endpoint blog by Ron Jacobs. Regularly delivered technical content is a little harder to find but I hope that someone on the team is able to take on that opportunity in the future. In the meantime you do have more than a thousand articles to read if you haven’t already.
MSDN will be migrating to a new blog platform during all of next week. During that time comments will be disabled, posts will be in the process of migration, and new theme and profile systems will be switched in. I’m planning to hold off trying to post on the normal schedule to avoid having to deal with the pain of migration. That means no posts for at least the next week until everything is back to normal. The entire archive should remain available during this time.
A new version of the Windows Identity Framework SDK and developer training kit is available targeting Visual Studio 2010 and .Net 4. The Windows Identity Framework SDK includes samples and Visual Studio templates while the training kit includes hands-on labs and training resources.
The SDK and training kit each have a download option for .Net 3.5 and a download option for .Net 4. It looks like installing both versions of either the SDK or training kit does not work particularly well. The .Net 3.5 option is for use with Visual Studio 2008. The .Net 4 option is for use with Visual Studio 2010. Pick the option matching the framework and Visual Studio version you’ll be using. One exception is that the .Net 4 training kit includes Windows Azure resources targeted at .Net 3.5.
When browsing to a service hosted in IIS I get an error that the protocol does not have an implementation of HostedTransportConfiguration type registered. What can cause this?
Two things to look at are the IIS site bindings and the installed activation services. All of these examples use net.tcp with default settings but you can substitute in other protocols and options similarly following the same checklist.
First, a configuration for the protocol scheme needs to be associated with the web site. This is normally done when the web site is first set up, but you can add additional site bindings from the command line using the appcmd utility.
appcmd set site "Default Web Site" -+bindings.[protocol='net.tcp',bindingInformation='808:*']
Second, the site binding for the web site needs to be enabled on the particular application that is to be activated. Again, this is usually done when the web site is first set up but can be changed using the appcmd utility.
appcmd set app "Default Web Site/myapp" /enabledProtocols:net.tcp
Finally, the service that hosts the protocol handler needs to be installed and running. You can check the status of the activation service using the sc utility.
sc query nettcpactivator
If the service is not present or is stopped, then that likely means that the Windows component (for client versions of Windows) or the server role and features (for server versions of Windows) are not enabled. The pkgmgr utility can be used to update the component setup.
pkgmgr /iu: WCF-NonHTTP-Activation
The WCF Data Services team has released the source code for their OData client libraries on .Net 3.5 SP1 and Silverlight 3. This may be of benefit to anyone trying to write their own library for the OData protocol. OData is a protocol for querying and updating data stored using a particular class of data models. The source code is released under the Apache 2 license.
Also recently they’ve put out an update to ADO.NET Data Services for Windows 7 and Windows Server 2008 R2. Data Services are REST-based web services that expose a data model that can be consumed by web clients. Data Services use URIs to address data from a storage system and supports a variety of formats for representing that data, such as JSON or ATOM. This update addresses the issues listed in KB article 982307.
Dominick Baier has a visualization for claims in the Visual Studio debugger. I’m not sure what other details to provide. It takes an identity and description for a claim and describes the issuer, metadata, and properties that make up the claim.
WCF services in IIS use a .svc file to bootstrap the process of activating a service. It’s possible but not recommended to put the entire service source code and definition in a .svc file to be dynamically compiled and run. Instead, the information that’s typically conveyed is:
Based on the provided information, the service host factory is created, the service definition is loaded, and the service starts listening on the base address.
In .Net 4 it’s possible to define services through application or machine configuration as an alternative to creating a .svc file. The configuration includes the same information the .svc file would.
Service activation configuration is a new configuration element within the ServiceHostingEnvironment configuration section. The service activation configuration is a collection of service definitions that specify for each service:
The relative address functions exactly as if a file exists at the specified location. Based on the path of the relative address, requests will be passed to the service. Based on the extension of the relative address, a build provider will be invoked to construct the service. The only difference from before is that you don’t have to actually create or deploy the separate service files. Service files are virtualized from the information provided in the configuration.
Can the routing service introduced with .Net 4 be used with impersonation?
Yes, the routing service can be used with impersonation for both sending and receiving messages. All of the usual Windows constraints of impersonation apply. If you would have needed to set up service or account permissions to use impersonation when writing your own service, then you’ll have to do those same steps to use impersonation with the routing service. The WCF configuration for impersonation is simplified though.
Impersonation with the routing service requires either the use of ASP.NET impersonation while in ASP.NET compatibility mode or the use of Windows credentials that have been configured to allow impersonation.
The only step to use ASP.NET impersonation with the routing service is to enable ASP.NET compatibility mode on the service hosting environment. The routing service has already been marked as allowing ASP.NET compatibility mode and impersonation will automatically be enabled. Impersonation is the only supported use of ASP.NET integration with the routing service.
To use Windows credential impersonation with the routing service you need to configure both the credentials and the service. The client credentials object that you use has an allowed impersonation level that must be set to permit impersonation. Finally, on the service you need to configure the ServiceAuthorization behavior to set ImpersonateCallerForAllOperations to true. The routing service uses this flag to decide whether to create the clients for forwarding messages with impersonation enabled.
A WCF application in IIS is a service page that is hosted under a site. You can assign different bindings to the site that describe the protocols through which the site can communicate. It’s possible to assign multiple protocols to a single site by specifying bindings that have different protocol schemes. It’s also possible to assign multiple addresses for a single protocol to a single site by specifying bindings that have the same protocol scheme.
WCF has supported services hosted in IIS that have multiple protocols but not services that have multiple addresses for a single protocol. A service with multiple base addresses for a single protocol scheme would fail to start running when activated. You could partially work around this limitation by supplying base address prefix filters. A prefix filter allows you to pick one base address to use with your service for each protocol scheme.
<serviceHostingEnvironment> <baseAddressPrefixFilters> <add prefix=”http://www.example.com:80”/> </baseAddressPrefixFilters> </serviceHostingEnvironment>
After filtering, other pages in the site could use any of the addresses while still allowing the WCF service to run. However, the WCF service would only be listening on the portion of addresses that start with the path defined by the filter.
In 4.0 you can enable support for multiple bindings with IIS without having to pick a single base address.
<serviceHostingEnvironment multipleSiteBindingsEnabled=”true” />
This feature for using multiple bindings with IIS is limited to HTTP protocol schemes though.
ReMIX is an annual twist on the MIX conference that takes a small portion of the content presented at MIX and combines it with new content and local speakers for a variety of sites around the world. There are generally ReMIX events announced throughout the year starting shortly after the MIX conference is held in Las Vegas.
Here are a few that have been announced so far:
Atlanta, Georgia is hosting a ReMIX conference May 8th for the southeastern United States
Moscow is hosting ReMIX May 21st along with a DevConf WebCamp earlier in the week
Melbourne is hosting ReMIX during June 1st and 2nd
And of course you can always watch the online videos recorded from the original MIX conference.
Windows Server AppFabric provides management, monitoring, and other component services for WCF services using .Net 4. The beta 2 release of AppFabric came out a few weeks ago using the release candidate of .Net 4. Now that the final version of .Net 4 is available, you can get a refreshed version of Windows Server AppFabric Beta 2. You should completely uninstall any preview releases of .Net 4 and AppFabric before installing the final version of .Net 4 and the updated AppFabric beta.
If you haven’t tried Windows Server AppFabric, then there are some new Channel 9 videos available that walk through the features in the AppFabric dashboard as an introduction.
The configuration of an IIS site includes the ability to associate a host name with a particular site definition. For HTTP traffic this allows multiple web sites to be hosted at the same IP address and port, with the true domain name of the site mapped using the host name header. For example, if you have a limited number of IP addresses available and many domains that you want to host all on port 80, then you can specify a different host header for each site to distinguish the traffic.
However, for HTTPS the ability to provide host headers is disabled in the interface. There are two different (but related) reasons for this difference in behavior.
First, the typical HTTPS certificate is usually generated for a single fully qualified domain name. Getting a certificate that has a wildcard in the domain name or that has multiple listed common names usually requires additional requirements by the certificate authority before being issues. If you didn’t know to ask for this, then you probably don’t have the right type of certificate for hosting multiple HTTPS sites. A certificate against a single name doesn’t need configuration to be used because there is only one valid value that you could use it with.
Second, the infrastructure for processing certificates is actually bound to the IP address and port rather than the site. Certificate processing is largely complete by the time the HTTP kernel driver hands the request off to the web server. A decision about how to process the message needs to be made before IIS has a chance to apply its service configuration. This is not a simple layering problem of the implementation but rather something more fundamental about the protocol. In order for IIS to extract the information from the message that it needs to identify the site, the certificate processing needs to be done first so that the decrypted message can be examined. Changing the order of steps to solve the original problem would simply create a new problem.
Fortunately, the loose coupling between the HTTP driver and the IIS host header configuration aids in solving the problem of order. If you have a properly provisioned certificate, then the message can be seen to match one of the provided names even if the HTTP driver doesn’t know which. This allows the mapping to be deferred until the site configuration and decrypted information are both available. The interaction between the different layers of the stack pushes the scenario beyond the limits of what the user interface makes easy though.
After adding a custom binding element to configuration as a binding element extension, Visual Studio reports any use of the binding element in app.config as a schema violation. Is something wrong with the binding element?
No, as long as the binding is able to be instantiated when you run the service you know that the binding element extension is working correctly. Visual Studio reports a configuration extension as a schema violation because the resulting configuration file will contain elements that are not a part of the original schema definition for a .config file.
If you’d really like to eliminate the schema violations, then you can modify the schema files that Visual Studio uses to match your installed configuration extensions. Under the Visual Studio installation directory is the path \Xml\Schema\ which contains the reference definition for schemas. The definition for .config is part of the monstrously large DotNetConfig.xsd schema file. There is a version of the schema file for each previous .Net version as well. You can update the schema to customize how validation works in the editor but very few people bother to do this.
Two frequently used network diagnostic tools have gotten beta updates this week.
Network Monitor is an adapter level capture program that can record and analyze protocol traces. If you join the Connect beta program for Network Monitor 3 you can get access to the latest Network Monitor 3.4 beta release. Network Monitor 3.4 has a number of improvements to the user interface, filtering system, and the included set of protocol parsers.
Fiddler is an HTTP proxy server that allows you to intercept and modify HTTP traffic for applications in a variety of ways. The Fiddler 2.2.9 beta is available for download and includes some significant improvements to performance and connection use.
When using DataContractSerializer with a data member that has IsRequired set to false, the generated schema has minOccurs of 0. However, when using XmlSerializer with an XML element that has IsNullable set to true, the schema has minOccurs of 1. Instead, the schema has nillable set to true. How do I get the XmlSerializer behavior to match DataContractSerializer?
This difference in schema is due to differing ways of representing the lack of a value.
The schema attribute minOccurs is the minimum number of times that the named element must appear for the document to be valid. When minOccurs is 0, then that means it is legal for the element to not appear at all. Therefore, you can represent the lack of a value by omitting the element.
The schema attribute nillable indicates whether the named element can be set to a special nil value that is not in the ordinary range of values for the type of the element. When an element is set to nil, then that means the writer intentionally provided no value. Therefore, you can represent the lack of a value by saying the value is nil.
The DataContractSerializer IsRequired mechanism uses the first approach for representing the lack of a value while the XmlSerializer IsNullable mechanism uses the second approach. However, XmlSerializer also has a way of using the first approach.
The XmlSerializer pattern used to omit an element is to associate the element with a separate Boolean value indicating whether the element should be omitted. The association is done by name like this:
[XmlElement] public string Id;[XmlIgnore] public bool IdSpecified;
The three requirements for XmlSerializer to make the association are:
When generating metadata to describe a service, an address is published for the location at which the service can be reached. This is the address to which a client of the service should address a message.
Ordinarily, the metadata address is obtained by looking at the address at which the service is listening for messages. However, if you have a router that forwards messages from a publicly addressable location to a service at a privately addressable location, then the address that the service is listening at is different than the one that should appear in the metadata. A client should send messages to the router’s publicly addressable location rather than trying to send messages to the service directly.
We created a fix for .Net 3.5 to allow the metadata generation for the service to use the address to which the metadata request was sent instead of the address at which the service is listening. After installing the fix, you can add a new service behavior called UseRequestHeadersForMetadataAddressBehavior to your service configuration. The metadata exchange endpoint looks for an instance of this behavior in the service description when generating metadata. In addition to changing the generated address, the behavior also provides a limited way to further remap the port portion of the address.
This fix is available for download from KB article 971842.
The Silverlight 4 business application training course is a set of videos and labs divided into eight modules for learning about building business applications with Silverlight. The primary focus of the training course is to learn about the new features in Silverlight 4. Existing preliminary material is gathered together to go over the features that are now available.
The eight modules cover: an introduction to Silverlight 4, WCF RIA Services, authoring basic controls, interacting with system resources, advanced controls, printing, running out of browser applications, and MEF.
You can work through the course either online or by downloading a large chunk of the resources to run locally.
Moonlight, the Linux version of Silverlight, has produced its sixth preview release of Moonlight 3. I don’t announce every release that they do because the team has a very short development cycle; the last announcement I did was for the first preview release of Moonlight 3 and that was less than three months ago. The reason I picked this preview to call out is because it’s the one that gave me a “past the halfway mark” feeling relative to the goals they originally announced for Moonlight 3. I’m not quite ready to put a guess in for when they’ll be done though.
Some of the improvements from the last few months have been around text control styling, smooth streaming, socket support, compatibility with popular sites, and integration with Firefox and Chrome. Moonlight 3 Preview 6 is largely on the way to compatibility with the feature set of Silverlight 3.
You can download the Moonlight preview from the Mono site as well as file a bug report for any issues you find.
Late last week a second release candidate for WCF RIA Services was released. RIA Services are an application design pattern that lives between ASP.NET and Silverlight in a multi-tier architecture. Inside RIA Services you can host application logic for data access control, queries, and other data operations. Integration with Silverlight components and controls allows for data validation and access control to automatically be made available to the client.
The update from the release candidate at this year’s MIX event includes bug fixes, improvements to tracing and debugging, and some minor feature enhancements. This release candidate also has a corresponding April update to the RIA Services toolkit.
This installation requires having previously installed Visual Studio 2010 and the Silverlight 4 Tools.
Moving to Visual Studio 2010 is a developer guide for learning about the new features of Visual Studio 2010. The final version is planned to come out in a few months. The content so far is as much about the libraries released at the same time as Visual Studio 2010, such as MEF and ASP.NET MVC 2, as about the Visual Studio program itself.
Different parts of the book tell the story from each of the perspectives of Visual Studio 2003, Visual Studio 2005, and Visual Studio 2008. The preview draft is of the material for Visual Studio 2005.
Ten talks of interest for web service developers from the recent TechDays 2010 and DevDays 2010 conferences. I've pulled out the videos on WCF, WCF service development, and web service development with Silverlight that you might be interested in.
What's New in WCF4
Learn about new features in WCF4, such as configuration-less services, service discovery, routing, REST-support, declarative services and others.
This session will discuss this out-of-the-box functionality and dive into the details about building Silverlight Applications. Silverlight will be used to build RIA's to visualize SharePoint data in an attractive way, both inside the existing SharePoint UI as running as an application out-of-the-browser.
What's new in WCF 4
WCF 4 brings with it simplification of service configuration and improvements to the discovery and monitoring of services. See how these improvements along with the new routing service can address scenarios such as versioning, application routing, and other common requirements that benefit from more decoupling between the client and service. In addition, we will discuss the improvise to the REST (web) programming model and workflow services.
Windows Server Appfabric Hosting and Caching
In this session, Ingo Rammer gives you an overview of Windows AppFabric - the new application server extension from Microsoft. You will learn how to develop, deploy and control WCF and WF applications running on this platform (formerly known as "Dublin") so that you can rely on existing infrastructure to host your server-side logic. In addition to hosting, Ingo will show you how you can take advantage of distributed caching (formerly codenamed "Velocity") to scale your web applications to new levels.
Windows Identity Foundation Overview
Hear how Windows Identity Foundation makes advanced identity capabilities and open standards first class citizens in the Microsoft .NET Framework. Learn how the Claims Based access model integrates seamlessly with the traditional .NET identity object model while also giving developers complete control over every aspect of authentication, authorization, and identity-driven application behavior. See examples of the point and click tooling with tight Microsoft Visual Studio integration, advanced STS capabilities, and much more that Windows Identity Foundation consistently provides across on-premise, service-based, ASP.NET and Windows Communication Foundation (WCF) applications.
WCF Data Services Beyond the Basics
This sessions covers how to leverage the latest WCF Data Services in .NET 4.0 to build a hosted and distributed data services which integrate a heterogeneous set of data sources. The content of this session is derived from a real world incubation project which is built on top of WCF data services, leveraging query interception, re-writing and re-routing, claim based security integration using WIF and custom meta data providers to deal with change schemas under the covers.
Entity Framework / Data Services in .NET 4.0
Data programming in .NET 4 has undergone a great deal of work based on customer feedback. This session will cover the improvements made to Entity Framework (EF) to make your data layer more testable, the use of POCO objects and T4 templates for customization of the entities, and more. In addition, we will cover the improvements to the Data Services programming model including updated support for databinding, query projection, and custom data providers.
Building business data-driven applications FAST with WCF RIA Services and Silverlight
WCF RIA Services is a new framework allowing you to get easy access to your data in Silverlight 4 applications. While still in beta, this new framework has already caused quite a stir in the community. In this session, we'll take a look at the framework and its features such as validation, authentication, sorting of data, data binding etc. While we'll use slides, demos make up the larger part of this presentation!
What's new in Silverlight 4 Part 1
In this session we'll take a demo-based approach to exploring the top new features that come with Silverlight 4. We'll take a look at the capabilities that combine to make Silverlight great for business applications with key features like printing, copy-paste, clip-board access and the possibility to relax the security sandbox for out-of-browser applications in order to better integrate with the software stack on the local machine. We'll also take a look at the other core capabilities like webcam and microphone integration, greatly improved data-binding, Visual Studio 2010 support and a lot more. Come along and get a picture of what Silverlight 4 provides as a platform for Rich Internet Applications in 2010.
What's new in Silverlight 4: Part 2
Managed Extensibility Framework (MEF) through Silverlight
Extensibility is a key design point for many applications such as the Microsoft Office applications with their plug-in model for extensibility. Silverlight 4 ships with a new framework, the Managed Extensibility Framework (MEF), which provides a flexible way of building extensibility into your applications with capabilities for discovering and composing extensions at run-time in a dynamic and loosely-coupled way. In this demo-based session we'll take a tour around MEF and look at its capabilities for building extensibility into your applications and also how it can be used in implementing the Model->View->ViewModel (MVVM) pattern in Silverlight applications.
The Service Bus and Access Control online services through Windows Azure AppFabric have now moved from being a trial service to a fully supported service. The service bus is an infrastructure piece for connecting together different components in a distributed application. The access control service allows you to integrate those connected components with a variety of identity providers. Both of these services can then be used together with the application services that you develop for Azure.
The official start of Azure AppFabric services also comes with an updated SDK release. The main download for the April 2010 SDK includes the SDK libraries, documentation, and samples. Consult the release notes for a description of the breaking changes and known issues in the release.
The WCF 4 sample collection is now available as a direct download independent from the framework or SDK release. The collection includes over 200 WCF samples from both .Net 4 and past releases. These samples go along with online sample guides available from MSDN.
You can also get the Visual Studio 2010 and .Net 4 training kit which covers a lot more than just WCF. Training kits are a collection of presentations, hands on labs, and demos related to the new features in a release. The kit spans a variety of technologies from the Visual Studio tools, languages, libraries, and Windows 7.
Both of these are meant to be used with .Net 4 and Visual Studio 2010 but most of the content doesn’t require the dependencies to be useful.
The Silverlight 4 launch event at the DevConnections conference will be taking place today. Starting off later this morning at 8 AM is the keynote address by Scott Guthrie. A link to stream the keynote presentation isn’t available yet but will be on the Silverlight site prior to the start. Additional interviews and videos will be available in the same place from the conference later in the day.
The release events for Visual Studio 2010 and .Net 4 started this morning and will continue throughout the day with conference presentations at multiple sites. If you want to join in, there’s a web cast of the keynote presentations from the Las Vegas site later this morning at 8:30 AM PST.
Downloads for the release will start opening up shortly with access for MSDN subscribers scheduled for later today. I’ll add links to this announcement as they become available.