Schema Errors Extending Configuration

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…


Optional Xml Fields

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…


Finding Your Place

How do I examine the settings for the endpoint that the message for the current operation was delivered to? There are two sources of settings depending on whether you’re interested in the endpoint runtime settings or the endpoint description. The endpoint description is the blueprint from which the endpoint was built. The endpoint runtime is…


Referring to Generic Interfaces in Contracts

How do I write a contract type that has a generic parameter in a service configuration file? A contract reference is part of the template for defining a service endpoint through configuration: <endpoint address=”…” binding=”…” contract=”…” /> Now, you need to fill in the contract value based on the full name of the service contract…


Rolling Your Own Status

I’m trying to use an HTTP method that has defined a private protocol for status code. What can I do if the HttpStatusCode class doesn’t have the necessary value? The HttpStatusCode enumeration contains predefined constants for the status codes described by the HTTP 1.1 standard. Here you can take advantage of the fact that an…


Full and Partial Profiles

What is the difference between the client and full framework profiles? Which one should I target? The use of profiles has changed considerably from .Net 3.5 to .Net 4. In .Net 3.5 a client profile was introduced for Windows XP to be able to have a small web download that could run many applications that…


Transaction Not Available

Can I run code under a flowed-in transaction from within a message inspector? The setup work for the service transaction is done shortly before the actual call to the implementation of the service operation. The service transaction is not guaranteed to be available for any of these extensibility points (although for certain kinds of transacted…


Debugging with Framework Source

How do I debug calls that go through WCF? The easiest way to get started debugging through the framework is to enable source server support in Visual Studio. Source server support allows you to start debugging and have Visual Studio automatically download source code for the framework that you step into when it is available….


Temporary Shadow Files

Why are the code files for a WCF service running in IIS copied to the Temporary ASP.NET Files folder? When an assembly file is loaded, that file is locked to prevent changes while the application is running. A service that is running in IIS will continue to run until the application domain is unloaded, which…


Ignoring MustUnderstand

How can I configure a client or server to handle messages even if a required header isn’t understood? The SOAP mustUnderstand attribute on a header is used to indicate that processing the header is required in order to properly handle the message. If the header can’t be processed, then a fault is supposed to be…