Nicholas Allen's Indigo Blog

Windows Communication Foundation From the Inside

June, 2009

  • Nicholas Allen's Indigo Blog

    Michele’s Norwegian Developers Conference Slides

    • 0 Comments

    Michele Bustamante has published the slides and demos from her talks at the recent Norwegian Developers Conference. Michele has some great variety in material covering WCF, Azure services, and security.

    You can get the complete set of slides which includes:

    • A Lap Around Geneva Framework
    • Access Control Service: Federated Security in the Cloud
    • Windows Azure - Your Operating System in the Cloud
    • Building a Windows Communication Foundation Router - Today and Tomorrow
    • Choosing the Right Data Access Technology
    • Cloud Computing with Windows Azure and the Azure Services Platform

    The samples and demos are available on Michele’s blog.

  • Nicholas Allen's Indigo Blog

    Checking for a 4.0 Framework Install

    • 2 Comments

    How can I tell whether a machine has the 4.0 framework installed?

    Checking for the presence of the installation registry value is still a straightforward way of doing this reliably. A slight complication is that in 4.0 there has been a split into the full and client framework profiles. Installing the full profile includes a copy of the client profile but the client profile might be used and updated independently. A limited subset of WCF is available in the client profile.

    The registry keys for the client and full profiles are:

    Software\Microsoft\NET Framework Setup\NDP\v4\Client

    Software\Microsoft\NET Framework Setup\NDP\v4\Full

    If the corresponding profile is installed, then these keys will contain a value named Install set to 1.

    For the historically curious, here are the corresponding registry keys to check for older versions of the framework:

    Software\\Microsoft\\.NETFramework\\Policy\\v1.0

    Software\\Microsoft\\NET Framework Setup\\NDP\\v1.1.4322

    Software\\Microsoft\\NET Framework Setup\\NDP\\v2.0.50727

    Software\\Microsoft\\NET Framework Setup\\NDP\\v3.0

    Software\\Microsoft\\NET Framework Setup\\NDP\\v3.5

    The name and location of the installation registry value varies from version to version a bit. However, the same test as used for 4.0 does work for 1.1, 2.0, and 3.5.

  • Nicholas Allen's Indigo Blog

    Via on Demand

    • 0 Comments

    How do I specify a delivery address for messages from a proxy that are different from the service address?

    Two different addresses are sometimes both referred to as the address for sending messages. There is a logical address, called the To address, that is the address that identifies the service. There is a physical address, called the Via address, that is the address that identifies where the service is located. The two addresses can be independently specified but when there is only a single address specified it is typically understood that the two addresses are the same.

    You’ll see this split of addresses continue throughout the object model from services down to channels. Thus, if you’re just constructing your own proxy objects, you could simply specify the two addresses directly.

    However, in other cases you’re relying on a client description to specify the characteristics of the proxy. In that case you can use a ClientViaBehavior on the client endpoint configuration to set a target URI for the Via address. The Via address for the ClientViaBehavior is transferred to the client runtime and causes any proxy built using that client description for which a Via address is not explicitly specified to use this default value. If you don’t explicitly specify a Via and you haven’t set a default Via address, then you’ll get the To address reused for the Via.

  • Nicholas Allen's Indigo Blog

    WCF Load Test Tool 3.0 Beta

    • 1 Comments

    Rob Jarratt has updated the community-driven WCF load test tool with a new beta release. The test tool uses a trace captured from a previous run of a WCF service to automatically generate a test case that performs the same sequence of operations. This allows you to quickly turn a hand-crafted test into one that is reproducible.

    This release adds support for testing ASMX services (where a new client proxy has been generated using WCF) as well as a variety of enhancements to support additional WCF features that the tested service can include.

  • Nicholas Allen's Indigo Blog

    Azure Services How To

    • 1 Comments

    The Azure Services developer center has a video series based on “How do I?” questions about writing services using the platform. These videos cover a variety of topics for Windows, .Net, Live, and Data cloud services.

    For example, here are the videos in the series on .Net services:

    Most of the videos in the series are 10-15 minutes long. You can get the complete catalog of videos for Azure services on their developer center learning page.

  • Nicholas Allen's Indigo Blog

    June 2009 Edition of the MSDN Community CD

    • 1 Comments

    The MSDN Community Distribution program has put out another developer CD in their mostly-bimonthly series of training programs. The community distribution was designed to increase the availability of development resources to those in emerging countries, but anyone can download and use the content.

    The June 2009 edition covers: an introduction to .Net 4.0, new features in Visual Studio 2010, ASP.NET AJAX 4.0, an introduction to SQL Server 2008 devlopment, Windows 7 user interface features, and an introduction to SQL Server Integration Services.

    The last few past releases are:

    March 2009: Highlights of MIX 09, Microsoft Virtual Earth Silverlight Map Control CTP, ASP.NET MVC Release Candidate 2, Microsoft ASP.NET 4.0 Data Access, Microsoft Silverlight and WPF, Microsoft ADO.NET Entity Framework, Using the Windows Azure Tools for Microsoft Visual Studio to Build Cloud Services

    January 2009: Overview videos of Silverlight 2.0, Visual Studio 2008 and the .NET Framework 3.5 SP1, Windows Presentation Foundation, how to Build an Office Application with Visual Studio Tools for Office and how to Create a Dynamic Web Application with ASP.NET 3.5, Windows 7 Developer Guide v1.2, Engineering Windows 7, Internet Explorer 8 Developer Features and a case study on extending HPC capabilities

    November 2008: ASP.NET 3.5, Windows 7 Developer Guide,Video Teaching on Windows Communication Foundation, Free E-book Introducing Microsoft Silverlight 2, 2007 Microsoft Office Developer Help files and Help files for Excel, Outlook, Word, PowerPoint, Publisher, Project, SharePoint Designer and Microsoft Script

  • Nicholas Allen's Indigo Blog

    Serialization Methods for Collections

    • 0 Comments

    What methods do I need to implement to have data serialized and deserialized for a collection?

    Serialization considers there to be three primary types of collections: dictionary-based collections, list-based collections, and plain old collections (everything else that’s enumerable). That’s also the order in which a type is checked for collection support.

    Serialization then needs to search for a way to enumerate the collection contents for serialization and a way to add items to the collections for deserialization. These are the collection’s enumerate and add methods. The enumerate and add methods are based on the primary type of the collection.

    A dictionary-based collection supports enumeration through its key-value pairs and addition through a method called Add. These methods are generic when the dictionary is generic (and not when it’s not).

    A list-based collection supports enumeration of its values through their direct type and again addition through a method called Add. Like dictionaries, these methods are generic when the list is generic (and not when it’s not). Although Add is defined directly on the non-generic IList, it is actually inherited from the base collection type for the generic IList. Therefore, in the generic world, basic collections can function more like lists.

    A plain old collection supports enumeration of its values through their direct type (thus making IEnumerable a particularly plain collection) but somewhat lacks an equivalent to Add. In order to deserialize one of these collections you need to have defined your own Add method with the appropriate parameter type (depending on if the collection is generic or not).

  • Nicholas Allen's Indigo Blog

    Dublin Walkthrough Videos

    • 0 Comments

    Stephen Thomas has a two-part series of videos on Channel 9 covering an introduction to features in the Dublin application server. Dublin is a set of enhancements to Windows Server and IIS targeted at high-scale deployments of WCF and WF services.

    Inside the Windows Application Server Enhancements known as Dublin: Part 1

    Inside the Windows Application Server Enhancements known as Dublin: Part 2

  • Nicholas Allen's Indigo Blog

    Platform Changes in 4.0: Debugging

    • 0 Comments

    Another change in .Net 4.0 (together with Visual Studio 2010) is an easier debugging experience for investigating production issues in managed applications. One of the frequent challenges of investigating production issues is the need to do the investigation against an offline memory dump rather than a live process. Previously this has required learning how to use windbg or one of the managed debugging extensions such as SOS. These tools are much less friendly than Visual Studio.

    For .Net 4.0 applications in Visual Studio 2010 there is additional support for managed and mixed mode debugging from a dump file. Tess Ferrandez has more details about how to use Visual Studio 2010 with dumps. There are some caveats though as heap issues and dumps from earlier framework versions aren’t helped by these new features. However, anyone without a lot of experience doing command-driven debugging will probably find using Visual Studio to be much easier than what was available before.

  • Nicholas Allen's Indigo Blog

    Platform Changes in 4.0: Security

    • 0 Comments

    The beta 1 release of .Net 4.0 has some big differences compared to previous releases for dealing with code security. If you’ve used the CAS (code access security) model then you might know it’s a fairly complicated set of policies and assertions for working out whether your program has permission to perform a particular action. In 4.0, desktop applications use a security model more similar to the simpler Silverlight model. Much of the details about the simplified security model are available on MSDN.

    You can also read about how to update applications to use the new security model or switch back to the old security model on the CLR team blog.

    The WCF users that will care about these changes are primarily those that were using partial trust, such as in a hosting environment.

  • Nicholas Allen's Indigo Blog

    Managed API for Windows Features

    • 0 Comments

    The Windows API Code Pack put out a new update recently (version 0.90) that adds new supported APIs to the set of managed wrappers around native Windows features. The code pack is a way to provide access to Windows features that lack an existing managed interface in the framework today, primarily for things added in Windows Vista and Windows 7. For example, the code pack allows you to integrate with newer shell, dialog, power, and DirectX features.

    One set of APIs that WCF developers may be interested in that are new in this release of the code pack are the Network List Manager APIs. These allow you to enumerate all of the different networks that the computer has seen, including some properties about the networks and their current connectivity status, which may be useful for applications running on multihomed machines.

  • Nicholas Allen's Indigo Blog

    Collection Name Generation

    • 0 Comments

    Last time we were looking at how to replace the default names used for serializing collections, such as ArrayOfKeyValueOfstringArrayOfstringty7Ep6D1, with more intelligible names. However, where did that funny looking name come from in the first place?

    The generation of default names is based on straightforward substitution and appending of data contract names.

    The default name of a list is ArrayOf followed by the name of the data contract that describes the list’s contents.

    Similarly, the default name of a dictionary is ArrayOfKeyValue followed by the names of the data contracts that describes the dictionary’s keys and the dictionary’s values. Thus, you can think of a dictionary as being modeled as an array of entries, each entry a data contract named KeyValue followed by the names of the data contracts that describes the dictionary’s keys and the dictionary’s values. In fact, that’s exactly the name of the data contract that describes the entry.

    The usual subtleties of data contract naming apply for collection names. For example, when generic parameters are used, the name is further appended with a hash based on the data contract namespace if the types involved are not primitive types. That’s where the ty7Ep6D1 comes from in this case. As another example, you have to be careful to distinguish the data contract names being used here from type names. In some cases, the data contract name and type name look the same, such as string being named string. In other cases, the data contract name and type name look quite different, such as object being named anyType.

  • Nicholas Allen's Indigo Blog

    RIA Services Roadmap

    • 0 Comments

    If you’ve tried out RIA Services for integrating Silverlight with multi-tier distributed applications, you might be interested in their recent roadmap update for getting to a first release.

    The existing May preview and samples will be followed by a July preview that tries to shake out the remaining major changes.

    The beta is at PDC this year.

    The first release is in 2010 using .Net 4.0 as a prerequisite.

    Dinesh Kulkarni has more details in the complete roadmap update.

  • Nicholas Allen's Indigo Blog

    Naming Collection Items

    • 1 Comments

    How do I replace the names of entries in a collection?

    By default the names inside of a collection are based on the type or role of the entry.

    <CheeseMap>
    <KeyValueOfstringCheeseListLjh4bohd>
    <Key>Sweden</Key>
    <Value>
    <string>Adelost</string>
    <string>Graddost</string>
    <string>Vasterbottenost</string>
    </Value>
    </KeyValueOfstringCheeseListLjh4bohd>
    </CheeseMap>

    This provides a certain style of object serialization that is very utilitarian but is not what a format that was crafted by hand has probably picked. People generally like to pick names that describe what an entry is rather than what it does.

    You can replicate the particular format names of a collection by using the CollectionDataContract attribute to customize serialization. Ordinarily, collections just work together with serialization through the magic of defaults. CollectionDataContract only shows up in these situations where the defaults are not what you want.

    Four changes you might want to make are:

    • Changing the list entry name using CollectionDataContract on the list with ItemName=”Cheese”
    • Changing the key name using CollectionDataContract on the dictionary with KeyName=”Country”
    • Changing the value name using CollectionDataContract on the dictionary with ValueName=”Cheeses”
    • Changing the dictionary entry name using CollectionDataContract on the dictionary with ItemName=”CheeseRegion”

    Putting together those changes, we go from the previous example into this:

    <CheeseMap>
    <CheeseRegion>
    <Country>Sweden</Country>
    <Cheeses>
    <Cheese>Adelost</Cheese>
    <Cheese>Graddost</Cheese>
    <Cheese>Vasterbottenost</Cheese>
    </Cheeses>
    </CheeseRegion>
    </CheeseMap>
  • Nicholas Allen's Indigo Blog

    Metadata Client Behaviors

    • 2 Comments

    Can I apply client behaviors to a MetadataExchangeClient to change how it retrieves metadata?

    Once a MetadataExchangeClient is built, you don’t have access to its internals to poke around at the description tree. You need to have set things up ahead of time to get the configuration that you want.

    One of the constructors for MetadataExchangeClient takes an endpoint configuration name that you can use to point at a client endpoint configuration including the behavior configuration.

    public MetadataExchangeClient(string endpointConfigurationName)

    However, that doesn’t help if you need to use one of the other constructor options, such as the client mode, or have an existing code implementation that you’re trying to change after the fact.

    Because the metadata endpoint is relatively guessable though, you know its address, its binding, and the contract is IMetadataExchange, another approach is to create an endpoint definition matching this triad and let the configuration system pick it up as the default named endpoint. This gets around the need to specify a custom named configuration by changing the problem that’s being solved.

  • Nicholas Allen's Indigo Blog

    Required Framework Versions

    • 1 Comments

    What framework versions do I need to have installed to use WCF?

    There have been five framework versions released plus various service packs for each version.

    • .Net framework 1.0 (up to SP3)
    • .Net framework 1.1 (up to SP1)
    • .Net Framework 2.0 (up to SP2)
    • .Net Framework 3.0 (up to SP2)
    • .Net Framework 3.5 (up to SP1)

    WCF first shipped as a part of the 3.0 framework and had new features added in the 3.5 framework. Therefore, you need to have one of those two versions installed with any level of service packs to use WCF. If you’re using particular features added in one of the later versions or service packs, then that increases the minimum required version.

    Because of the way the different versions are packaged, the 3.5 framework requires the 3.0 framework to be installed rather than duplicate all of its contents. Similarly, the 3.0 framework requires the 2.0 framework to be installed. The 1.0 and 1.1 framework versions can be uninstalled though without affecting your ability to run applications built for later versions.

  • Nicholas Allen's Indigo Blog

    Programming Exercises to Stay in Shape

    • 1 Comments

    Unless you are a very rare type of developer, you probably spend only a small percentage of your time on algorithmic development. Algorithms are one of the central topics in college education and interviews for developers tend to feature a lot of algorithmic questions. However, the bulk of producing a quality product is often not the algorithms but rather the time spent on design, testing, integration, documentation, and other issues. This can lead to an unexpected struggle at those times when algorithmic development is essential to completing a job.

    Programming competitions are one way to keep sharp. There are programming competition sites that directly pit you against others but I don’t find those as helpful because they tend to over emphasize speed. In a work setting you’re often scored more on absolute performance rather than the number of minutes required to come up with the solution. Those exercises are still useful in an offline setting if the questions are well put together and scoring can be done outside the contest. There are also a number of programming sites that provide challenges at your own pace.

    Three sites for programming exercises I recommend are:

    1. Project Euler- the problems here are generally mathematical and start insultingly easy while becoming quite hard. Checking solutions is particularly easy as the problems are designed to have short but unguessable output.
    2. ACM Contest Archives- this famous contest for college students doesn’t come with answers but is popular enough that you can probably find discussions for many of the problems. Each year’s problem set has a few that are of easy or medium difficulty and a few that are hard or very hard. Many of the problems are about selecting the correct data structures to model the solution.
    3. UVa Online Judge- an enormous number of problems of varying style and difficulty.
  • Nicholas Allen's Indigo Blog

    Inside Changes to the CLR 4.0 Thread Pool

    • 3 Comments
    WCF naturally produces applications that are both heavily multi-threaded and IO intensive. That makes WCF application performance distinctly influenced at times by the characteristics of the CLR thread pool. The thread pool is a collection of work and a collection of worker threads that it seeks to pair up to minimize the resources and time required to complete the tasks. In the 4.0 framework there aren't as many changes to the IO thread pool as in past releases but there are quite a few changes to the computation thread pool. Eric Eilebrecht has both a blog and a channel 9 video that talks about these.
  • Nicholas Allen's Indigo Blog

    Understanding Address Filtering

    • 1 Comments

    Ordinarily a message is delivered to an endpoint on the basis of the message's delivery address being equal to the endpoint's listening address. If there's no endpoint listening at that address then you get an EndpointNotFoundException and the message fails to be delivered. This is the exact matching model between the To address and the endpoint address.

    Sometimes though you want to be more lenient about how messages are delivered to endpoints. For example, if you want to process part of the address yourself, then you may want to match on a shorter address path while accepting messages being sent to any subpath. This is the prefix matching model.

    The use of different matching models for associating messages and endpoints is part of the local behavior of the service. You can specify how to do matching using the AddressFilterMode property on the ServiceBehavior attribute.

    [ServiceBehavior(AddressFilterMode = AddressFilterMode.Exact)]

    There are three choices for performing matching.

    • Exact: the default matching model is to require an exact match between the incoming message address and the endpoint address
    • Prefix: a weaker matching model is to require that the incoming message address is any path that is at least as specific as the endpoint address
    • Any: the weakest matching model is to simply match every address
  • Nicholas Allen's Indigo Blog

    Profiler Survey

    • 0 Comments

    Four short questions to keep the total time investment to a minimum. I generally don't click through to publish survey response comments so don't worry if your answer doesn't show up. I'll read all the responses for as long as comments are open.

    Do you use profiling tools with a .Net framework application that you've written? These can be any managed applications, not necessarily involving WCF.

    Is the profiler you use based on sampling or code instrumentation or some other mechanism?

    Are you profiling an application that runs on a single machine or on multiple machines?

    Are there any particular brands or features of profilers that you really like?

  • Nicholas Allen's Indigo Blog

    Just Exactly What You Asked For

    • 0 Comments

    When implementing a transport or layered channel class the marker used to indicate that your class is a channel is to implement the IChannel interface. Therefore, all channels will implement one of the known channel shapes: IInputChannel, IOutputChannel, IDuplexChannel, IRequestChannel, or IReplyChannel (optionally you might use the sessionful variant of one of these channel shapes instead).

    If your channel logically happens to support more than one of these channel shapes, then you should factor the implementation into multiple classes, each class supporting exactly one of the channel shapes. That is, each channel class should implement exactly one of the channel shapes. You can use inheritance or other means to share the implementation between the different channel classes as long as you adhere to the restriction on implementing shapes.

    The reason for the restriction is that a number of consumers interact with a channel based on its type rather than the type provided when creating the channel. This allows the consumer to avoid carrying this state information around. However, it means that if you implement channel interfaces that are not the actual type of the channel, then those consumers will act on your channel incorrectly based on the type that they see.

  • Nicholas Allen's Indigo Blog

    .Net Performance Survey

    • 0 Comments

    The CLR performance team is running a survey to get your feedback about what to focus on for performance in the .Net framework. This includes performance in the framework itself as well as performance profiling, optimization, and tuning for the applications that you write.

    If you have any WCF performance feedback you can always send it to me even if this survey later closes and I'll direct it to the right people.

Page 1 of 1 (22 items)