What's New in Windows Communication Foundation 4.0

06/04/2009

Controlling Service Activation Based on Available Memory

Some WCF services may not run optimally when memory resources are constrained. The Window Communication Foundation allows the user to configure a setting that specifies a lower bound on the amount of free memory when the service is run under Full Trust. If there is less free memory available than the value of this setting, the service will not be activated and an exception will be thrown. minFreeMemoryToActivateService is a configuration file setting that allows the user to specify a percentage of free memory that is required to be free in order to activate a service, the default value is 5 per cent.

Support for WS-Discovery

The Service Discovery feature enables client applications to dynamically discover service addresses at runtime in an interoperable way using WS-Discovery. The WS-Discovery specification outlines the message-exchange patterns (MEPs) required for performing light-weight discovery of services, both by multicast (ad hoc) and unicast (utilizing a network resource).

Standard Endpoints

Standard endpoint are pre-defined endpoints that have one or more of their properties (address, binding, contract) fixed. For example all metadata exchange endpoints specify IMetadataExchange as their contract, so there is no need for a developer to have to specify the contract. The standard MEX endpoint therefore has a fixed IMetadataExchange contract.

Workflow Services

With the introduction of a set of messaging activities it is easier than ever to implment workflows that send and receive data. These messaging activites allow you to model complex message exchange patterns that go outside of the traditional send/receive or RPC-style method invocation.

Web Hosting a .NET Framework 3.5 WCF Service on a Machine Running .NET Framework 4.0

When hosting a WCF service written with .NET Framework 3.5 on a machine running .NET Framework 4.0, you may get a T:System.ServiceModel.ProtocolException with the following text:

Unhandled Exception: System.ServiceModel.ProtocolException: The content type tex t/html; charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, b e sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<html> <head> <title>The application domain or application pool is currently running v ersion 4.0 or later of the .NET Framework. This can occur if IIS settings have b een set to 4.0 or later for this Web application, or if you are using version 4. 0 or later of the ASP.NET Web Development Server. The &lt;compilation&gt; elemen t in the Web.config file for this Web application does not contain the required 'targetFrameworkMoniker' attribute for this version of the .NET Framework (for e xample, '&lt;compilation targetFrameworkMoniker=&quot;.NETFramework,Version=v4.0 &quot;&gt;'). Update the Web.config file with this attribute, or configure the W eb application to use a different version of the .NET Framework.</title>...

Or if you try to browse to the service's .svc file you may see the an error page with the following text.

The application domain or application pool is currently running version 4.0 or later of the .NET Framework. This can occur if IIS settings have been set to 4.0 or later for this Web application, or if you are using version 4.0 or later of the ASP.NET Web Development Server. The <compilation> element in the Web.config file for this Web application does not contain the required 'targetFrameworkMoniker' attribute for this version of the .NET Framework (for example, '<compilation targetFrameworkMoniker=".NETFramework,Version=v4.0">'). Update the Web.config file with this attribute, or configure the Web application to use a different version of the .NET Framework.

These errors occur because the application domain IIS is running within is running .NET Framework 4.0 and the WCF service is expecting to run under .NET Framework 3.5. To fix this problem open the service's web.config file and find the <compilation> element. Add the targetFrameworkMoniker attribute as shown in the following XML example.

Posted in: C# and .NET| Tags: Communication NET .NET 4.0 New WCF Foundation service user framework contract ws-discovery memory

Hot Posts

Latest posts

Tags

Others

Sponsors

asp.net interview questions