Windows Communication Foundation Profile Service Overview

The Windows Communication Foundation (WCF) profile Web service enables you to retrieve ASP.NET profile properties from any application that can send and consume a SOAP message. You can use the WCF profile service from applications that do not use the .NET Framework, such as Java applications. By using the profile service, you can make the same user profile data available to different kinds of applications.

This topic contains the following sections:

You access the profile service as a WCF service when you need to retrieve or set profile properties from an application that is not an ASP.NET Web application. This can include a console application, a Windows Forms application, or an application that is not developed with the .NET framework. The application must be able to send and consume a SOAP message.

Back to top

The WCF profile service enables you to access ASP.NET profile properties that are defined in an ASP.NET Web application. The profile service acts as a bridge between an external client and ASP.NET profile properties.

Defining Profile Properties

You define your application's profile properties as you would for an ASP.NET Web application. Set the profile properties in the properties element of the Web.config file. For more information, see Defining ASP.NET Profile Properties. The following example shows how to configure three properties in the Web.config file.

  <profile > 
      <add name="Birthday" /> 
      <add name="FavoriteColor" />
      <add name="PostalCode" />

Enabling the Profile Service

To access profile properties as a Web service, you must enable the profile service and configure the profile properties that you want to expose through the Web service. By default, no profile properties are accessible through a Web service. Use the ReadAccessProperties and WriteAccessProperties properties to specify which profile properties to expose.

The following example shows how to enable the profile service in the Web.config file. It shows how to configure three properties for read access: Birthday, FavoriteColor, and PostalCode. However, only two of the properties allow write access, Birthday and FavoriteColor.

      <profileService enabled="true"
        readAccessProperties="Birthday, FavoriteColor, PostalCode"
        writeAccessProperties="Birthday, FavoriteColor" >

Configuring the Profile Service as a WCF Service

To use the profile service as a WCF service, add a WCF service file (.svc) file to the Web site. In the .svc file, add the following directive that references the ProfileService class. (The .svc file contains no content other than the directive.)

<%@ ServiceHost Language="C#" Service="System.Web.ApplicationServices.ProfileService"
Factory="System.Web.ApplicationServices.ApplicationServicesHostFactory" %>

You must also add some WCF values to the Web.config file to enable clients to bind to the profile service. In the services element, you add a value that defines the endpoint contract. Then you configure the serviceHostingEnvironment element for ASP.NET compatibility. In the basicHttpBinding element, you specify that cookies are allowed.

The following example shows how to configure profile service as a WCF service.

    <service name="System.Web.ApplicationServices.ProfileService">
      <endpoint contract=
         binding="basicHttpBinding" />
    <basicHttpBinding allowCookies="true">

For more information, see the following topics:

Accessing the Profile Service from a SOAP Client

You access profile data from a SOAP client by creating a proxy class for the ProfileService class. When you use programming frameworks other than the .NET framework to create the client, you use the tool for that framework to create a proxy class based on the metadata of the Web service. Your client application then accesses the profile service by calling the methods of the proxy class.

For more information, see Walkthrough: Using ASP.NET Application Services.

The ProfileService class contains the following operations that are accessible only through a WCF service:

These methods are private and are therefore not accessible through an instance of the ProfileService class. However, they are marked with the OperationContractAttribute attribute to make them available through a WCF service.

Back to top

The following table lists the key server classes for the WCF profile application service.


Provides access to user profiles through a Web service.


Provides a collection of values that describe a profile property.


Provides data for the ValidatingProperties event.

Back to top

Community Additions