Share via


How to Configure the Commerce Routing Service for a Two-Tier Commerce Deployment

This topic provides information to help you create a commerce routing service configuration to work as a proxy that handles calls between the Commerce Foundation API and a rich Internet application (RIA). When you deploy the  provided out-of -the-box with Microsoft Commerce Server 2009 R2, a routing service is preconfigured to enable the Silverlight-based Commerce Server Business Administration Ribbon built-in to the business user zone (Default zone). Use the information provided in this topic to create a commerce routing service instance based on the requirements of your commerce deployment.

The Commerce Server 2009 R2 routing service is a Windows Communication Foundation (WCF) service which contributes in securing the Commerce Foundation by:

  • Providing a security boundary through the separation of the presentation tier and RIA clients.

  • Adding support for more robust WCF bindings to Commerce Foundation resources.

  • Using the commerce session token to help mitigate the risk of cross-site request forgery (CSRF).

  • Limiting access to the Commerce Foundation by assigning strict minimum authorization privileges to the routing service identity, based on access requirements of the client application and the deployment environment.

  • Returning faults in a manner that is usable by other clients, such as Silverlight rich Internet application clients.

The configuration examples in this topic apply to an ASP.NET or a SharePoint 2010 two-tier commerce deployment.

Prerequisites

  • You are familiar with security requirements specific to your deployment environment. For information about security considerations when deploying a rich Internet application (RIA) with Commerce Server 2009 R2, see Considerations for Secure Deployment of Rich Internet Applications (RIAs).

  • A service account for the routing service must be configured. The routing service account is assigned minimum access privileges.

  • The application must include a RoutingService.svc that contains the following statement, based on the environment:

    • For SharePoint 2010, the content of RoutingService.svc file must be as follows:
    <%@ ServiceHost Language="C#" Debug="true" Service="Microsoft.Commerce.Portal.Common.SharePointRoutingService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35” %>
    
    • For ASP.NET, the content of RoutingService.svc must be as follows:
    <%@ ServiceHost Language="C#" Debug="true" Service="Microsoft.Commerce.Server.CommerceRoutingService, Microsoft.Commerce.Server, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
    

Adding a Commerce Routing Service Configuration to a Custom Web Application

The Commerce Server 2009 R2 routing service configuration is defined in the application Web.config file in a section located under "microsoft.commerce"/"presentation", shown in the following example.

<sectionGroup name="presentation">
        <section name="CommerceRouter" type="Microsoft.Commerce.Configuration.CommerceRouterElement, Microsoft.Commerce, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </sectionGroup>
...

Specify the Name of the Client-Side Commerce Operation Service

In the <presentation> section, specify the name of the client-side commerce operation service to be used by the routing service. This configuration refers to a commerce operation service which is defined in the Commerce Foundation WCF client-side configuration (under "microsoft.commerce"/"client")

In the following example, the routing service is configured to use the default IOperationService.

    <presentation>
      <CommerceRouter operationServiceName="IOperationService" anonymousAccessOperationServiceName="IOperationService" enableProxyCaching="false" delegateCommerceShopper="false" useHttpContextPrincipal ="true"/>
    </presentation>

Configure the Routing Service WCF Bindings

WCF bindings define how the Commerce Foundation client endpoint and the routing service endpoint communicate. The service and client endpoints must be configured to use compatible binding types.

  1. In a two-tier deployment the client-side must be configured to use an operation service running InProcess mode.

        <client>
          <CommerceOperationServices>
            <CommerceOperationService name="IOperationService" mode="InProcess" serviceImplementationType="Microsoft.Commerce.Server.OperationService, Microsoft.Commerce.Server, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
          </CommerceOperationServices>
        </client>
    
  2. In the <system.serviceModel> configuration section, create the routing service WCF bindings configuration. The following shows a configuration using BasicHttpBinding.

    <system.serviceModel>
       <behaviors>
          <endpointBehaviors>
            <behavior name="CommerceWebClientFaultBehavior">
              <commerceWebClientFaultBehavior/>
            </behavior>
          </endpointBehaviors>
          <serviceBehaviors>
            <behavior name="CommerceServiceBehavior">
              <errorHandlingBehavior/>
              <serviceDebug includeExceptionDetailInFaults="false" />
              <serviceMetadata httpGetEnabled="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <bindings>
          <basicHttpBinding>
            <binding name="BasicHttpBinding_IRoutingService">
            <security mode="TransportCredentialOnly">
            </security>
            </binding>
          </basicHttpBinding>
        </bindings>
        <extensions>
          <behaviorExtensions>
            <add name="errorHandlingBehavior" type="Microsoft.Commerce.Server.OperationErrorHandler, Microsoft.Commerce.Server, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add name="commerceWebClientFaultBehavior" type="Microsoft.Commerce.CommerceWebClientFaultBehavior, Microsoft.Commerce, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
          </behaviorExtensions>
        </extensions>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
        <services>
    
  3. Configure the routing service endpoint. Note that the routing service name differs based on the environment.

    <!-- Routing service name in a SharePoint deployment -->
          <service name="Microsoft.Commerce.Portal.Common.SharePointRoutingService" behaviorConfiguration="CommerceServiceBehavior">
    <!-- Routing Service name for an ASP.net deployment -->
    <service name="Microsoft.Commerce.Server.CommerceRoutingService" behaviorConfiguration="CommerceServiceBehavior">
            <endpoint name="RoutingService" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IRoutingService" contract="Microsoft.Commerce.IOperationService" behaviorConfiguration="CommerceWebClientFaultBehavior" >
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
          </service>
    

See Also

Other Resources

How to Secure a Commerce Routing Service