This post discusses the new features in WCF 4.5. There have been significant improvements in WCF 4.5 on configuration.

Simplifying the generated configuration file in client

A client configuration file is generated when you add a service reference in Visual Studio 2010. The configuration files in earlier version of WCF contained the value of every binding property even if it is a default value. In WCF 4.5 Configuration files contain binding properties that are set to non-default value.


Example of configuration file generated by WCF 3.0



Example of same configuration file generated by WCF 4.5




Single WSDL File

In earlier version of WCF, WSDL document specifies dependencies via xsd:import attributes. WSDL file generated by WCF looks as below




Some clients may not consume the above WSDL file generated from WCF earlier version. In WCF 4.5 there is a single WSDL file and no external references to schema types.


When you browse the service metadata file in WCF4.5 then you will see the below options




If you want the single WSDL file then you can use the second link which ending with ?singlewsdl


Multiple Authentication Support on single end point in IIS

Hosting the WCF Service is bit tricky. You will get an error message when your service endpoint authentication is not matching the IIS’s authentication types.




ClientCredentialType
attribute is a new feature in WCF 4.5 which tells the service to inherit the authentication types from IIS host.

Now you can enable multiple authentication types in IIS




After enabling the authentication types in IIS then if you browse service’s WSDL file then you will see the below authentication types




WebSocket Support

Two new bindings have been added to support communication over a WebSocket transport.


NetHttpBinding and NetHttpsBinding


Streaming Improvements

Support for asynchronous streaming has been added to WCF. To enable asynchronous streaming, add the DispatcherSynchronizationBehavior endpoint behavior to the service host and set its AsynchronousSendEnabled property to true. You will get the scalability benefit when service sending streamed messages to multiple clients.

In earlier versions when you host WCF service on IIS, there were some around buffering the messages. When receiving a message for IIS hosted service which used to stream a message, asp.net would buffer entire message before sending it to WCF.

Now the buffering has been removed in .NET 4.5 and now IIS hosted WCF services can process the incoming stream before the entire message has been received.

More about the features can be read here