Click here to Skip to main content
15,886,069 members
Articles / Productivity Apps and Services / Biztalk

BizTalk ESB Exception Handling – Consuming WCF Services – Part I

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
3 Nov 2012CPOL10 min read 28.1K   197   9  
Managing exceptions when consuming WCF services via the BizTalk ESB Toolkit
<?xml version="1.0" encoding="utf-8"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <!--
    The <configSections> section declares handlers for custom configuration sections.
  -->
  <configSections>
    <section name="bizTalkSettings" type="Microsoft.BizTalk.Adapter.Wcf.Runtime.BizTalkConfigurationSection, Microsoft.BizTalk.Adapter.Wcf.Runtime, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </configSections>
  <!--
    The <bizTalkSettings> section specifies BizTalk specific configuration.
  -->
  <bizTalkSettings>
    <!--
      mexServiceHostFactory debug:
      Set to "true" to launch debugger when MexServiceHostFactory.CreateServiceHost(...) is called by IIS.
      Used to debug from initial point of activation by IIS.
      Default value is "false" for normal operation.
    -->
    <mexServiceHostFactory debug="false">
      <receiveLocationMappings>
        <!--add markupFileName="*.svc" receiveLocationName="?" publicBaseAddress="protocol://host[:port]" /-->
      </receiveLocationMappings>
    </mexServiceHostFactory>
    <!--
      webServiceHostFactory debug:
      Set to "true" to launch debugger when WebServiceHostFactory.CreateServiceHost(...) is called by IIS.
      Used to debug from initial point of activation by IIS.
      Default value is "false" for normal operation.
    -->
    <webServiceHostFactory debug="false" />
    <!--
      isolatedReceiver disable:
      Set to "true" to skip IBTTransportProxy.RegisterIsolatedReceiver(...) and IBTTransportProxy.TerminateIsolatedReceiver(...) calls.
      Used for testing metadata exchange without having to setup receive location.
      Default value is "false" for normal operation.
    -->
    <isolatedReceiver disable="false" />
    <!--
      btsWsdlExporter disable:
      Set to "true" to skip adding BtsWsdlExporter behavior extension to service endpoint.
      Used for testing or comparing strongly-typed WSDL customization versus weakly-typed WSDL of generic WCF service.
      Default value is "false" for normal operation.
    -->
    <btsWsdlExporter disable="false" />
  </bizTalkSettings>
  <appSettings />
  <connectionStrings />
  <system.web>
    <!-- 
      Set compilation debug="true" to insert debugging symbols into the compiled page.
      Because this affects performance, set this value to true only during development.
    -->
    <compilation defaultLanguage="c#" debug="false">
      <assemblies>
        <add assembly="mscorlib, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" />
        <add assembly="Microsoft.BizTalk.Adapter.Wcf.Common, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add assembly="Microsoft.BizTalk.Adapter.Wcf.Runtime, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </assemblies>
    </compilation>
    <!--
      The <authentication> section enables configuration of the security authentication mode
      used by ASP.NET to identify an incoming user.
    -->
    <authentication mode="Windows" />
    <!--
      The <customErrors> section enables configuration of what to do if/when an unhandled error
      occurs during the execution of a request. Specifically, it enables developers to configure
      html error pages to be displayed in place of a error stack trace.
    -->
    <!--
    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
      <error statusCode="403" redirect="NoAccess.htm" />
      <error statusCode="404" redirect="FileNotFound.htm" />
    </customErrors>
    -->
  </system.web>
  <!--
    The <system.serviceModel> section specifies Windows Communication Foundation (WCF) configuration.
  -->
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviorConfiguration">
          <serviceDebug httpHelpPageEnabled="true" httpsHelpPageEnabled="false" includeExceptionDetailInFaults="false" />
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <!-- Note: the service name must match the configuration name for the service implementation. -->
      <service name="Microsoft.BizTalk.Adapter.Wcf.Runtime.BizTalkServiceInstance" behaviorConfiguration="ServiceBehaviorConfiguration">
        <endpoint name="HttpMexEndpoint" address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
        <!--<endpoint name="HttpsMexEndpoint" address="mex" binding="mexHttpsBinding" bindingConfiguration="" contract="IMetadataExchange" />-->
      </service>
    </services>
  </system.serviceModel>
</configuration>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Digging Dog Ltd
New Zealand New Zealand
I have almost 20 years commercial software development using a number of languages from C++ to C#/VB. My main focus has been in the Microsoft space and, since the early 2000's, most of this has been in the web or integration arena. Over the past few years I have been focusing on building business solutions using a variety of products such as BizTalk and Share Point.
In terms of SDLC's, I have experience with various methodologies such as Agile, RUP, Iterative and Waterfall.
Lastly, the roles I have had in the last few years have given me the opportunity to gain a lot of experience as a consultant. Since, over the last 18 years, I have worked with many customers this has further given me the chance to enjoy many and varying challenges that have helped me grow in my career.
Today, I spend a lot of time talking, designing, documenting and mentoring team members. I also spend quite a bit of time authoring software and find the combination a perfect fit for me.

Specialties
Consultancy, Solution architecture, Solution design, Project costing and tracking, Team lead, Software development, C#, VB, ASP.NET, HTML, DHTML, JavaScript, BizTalk, SharePoint

Comments and Discussions