Paul's Petrov Whiteboard

[BizTalk, Enterprise Application Integration, Business Process Automation, SOA, .NET]

  Home  |   Contact  |   Syndication    |   Login
  67 Posts | 1 Stories | 133 Comments | 30 Trackbacks

News

Archives

Post Categories

Image Galleries

BizTalk

Other

Friday, December 16, 2011 #

I just finished reading new book on Microsoft BizTalk 2010 written by BizTalk colleagues Kent Weare, Richard Seroter, Thiago Almeida, Sergei Moukhnitski, and Carl Darski. There are many good books that explore core BizTalk features for beginners, intermediate, and advanced developers. This one stands out by the fact that it covers relatively less documented aspect of BizTalk development – integrating with different line of business applications. The subject is vast and diverse so attempt to fit it in one book is a challenge by itself.

The book opens with the chapter on WCF Adapters SDK which can be good introduction into the world of WCF based adapters. It explains high level design and idea of LOB adapters and WCF bindings. The chapter contains a simple application example that uses custom WCF adapter. While working through this exercise readers will get acquainted with adapter metadata, binding configuration, endpoint URI, SOAP action mapping, and other fundamental concepts of the WCF enabled adapters.

Next chapter explores probably the most frequently used and well-known of the WCF Adapters – WCF SQL Adapter. All features of this adapter including more advanced like typed polling, notification and debatching are covered in details with examples. It makes this chapter great practical WCF-SQL handbook for all levels from beginner to advanced user and an excellent addition to the MSDN documentation.

Then follow few chapters each dedicated to one specific LOB application integration: Microsoft Dynamics CRM, WCF SAP Adapter, SharePoint, Dynamics AX, and SalesForce.  Every chapter has overview of the Line of Business application, its role in business processes, and then goes into detailed integration example with explanations, sample code, and screen shots.

Separate consideration deserves chapter on integration with Windows Azure Platform AppFabric. This is a new exciting feature of the BizTalk 2010 that expands its capabilities into the cloud based service bus solutions. This chapter alone makes the book worth having.

Overall, authors and editors has done a great job covering such wide and important area of BizTalk functionality. Sure, it’s impossible to go into very deep details and explore all intricacies of every LOB application in just one book. Yet this one is a very good starting point for any consultant in the field who has to deal with disparate systems integration on a daily basis.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Sunday, November 27, 2011 #

I took a shot at new (to me) certification exam for BizTalk 2010. I was able to pass it without any preparation just based on the experience. That does not mean this exam is a very simple one. Comparing to previous (2006 R2) it covers some new areas (like WCF) and has some demanding questions and situation to think about. But the most challenging factor is broad feature coverage. Overall, the impression that if BizTalk continues to grow in scope it’s better to create separate exams for core functionality and extended features (like EDI, RFID, LOB adapters) because it’s really hard to cover vast array of BizTalk capabilities.

As far as required knowledge and questions allocation I think Microsoft description is on target. There were definitely more questions on deployment, configuration and administration aspects comparing to previous exam. WCF and WCF based adapters now play big role and this topic was covered well too. Extended functionality is claimed at 13% of the exam, I felt there were plenty of RFID questions but not many EDI, that’s why I thought it’d be useful to split exam into two to cover all of them equally. BRE is still there and good, cause it’s usually not very known/loved feature of the package.

At the and, for those who plan to get certified, my advice would be to know all those areas of BizTalk for guaranteed passing: messaging and orchestrations, core adapters, routing, patterns; development of all artifacts and orchestrations; debugging and exceptions handling; packaging, deployment, tracking and administration; WCF bindings and adapters; BAM, BRE, RFID, EDI, etc. You may get by not knowing one smaller non-essential part (like I did with RFID, for example). In such case you better know all other areas very well to cover for the weak spot. If there more than one whiteouts in the knowledge it’s good idea to study and prepare: MSDN, blogs, virtual labs and good VM to play with can help when experience is not enough. So best wishes and good skill to you in passing this certification!

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Wednesday, September 28, 2011 #

This example is not covered in the ESB Toolkit samples and I bumped my forehead a few times while making it work. I thought it’d be helpful to save other fellow BizTalk'ers from headaches by publishing findings.

I have been fun of dynamic generic messaging for quite a while and went long ways to avoid working with typed messages and static bindings when it made sense. Nowadays, with the ESB Toolkit one does not have to spend much effort to achieve this goal. But one has to learn intricacies of configuration to unleash unlimited flexibility of the Toolkit.

Let's say we have a requirement to store some messages on service bus to the database. And the number of message types supported is growing plus their schemas can potentially change. If the database is SQL Server we can use an ESB Off-Ramp dynamically bound to WCF-SQL send port.

The send port interface can be implemented different ways. One is to generate typed WCF-SQL Adapter schemas for database objects (tables or procedures). Then create maps to transform original message to the adapter schema. This may potentially lead to complex maps that perform poorly, difficult to maintain and support. We also have to deploy new schemas every time new type is added.

Otherwise, we could use one-way port calling stored procedure that accepts entire message as a parameter and internally maps/saves message to the database. This saves us from creating and deploying stored procedure schema and map, as well as schema for the response message. We also gain performance on the BizTalk end by offloading XML to relational model mapping to the database engine which it does more efficiently. I chose this approach over the first.

Suppose, we have two message types http://contoso.com/schemas#PurchaseOrder and http://contoso.com/schemas#Invoice. We have created two stored procedures InsertPurchaseOrder and InsertInvoice. Each stored procedure accepts one parameter, the message body:

CREATE PROCEDURE InsertPurchaseOrder 
    @messageBody nvarchar(max)
AS
BEGIN
    SET NOCOUNT ON;
    
    DECLARE @docHandle int
    EXEC sp_xml_preparedocument @docHandle OUTPUT, @messageBody, N'<ns0:PurchaseOrder xmlns:ns0="http://contoso.com/schemas" />'

-- Perform mapping and insert here using OPENXML for example

END

Create BRE policy to resolve endpoint configuration:

 

In the Action area there are a lot of things being set up. Let's go through them one by one:

Parameter

Value

Notes

Set Endpoint Message Exchange Pattern

One-Way

Establishes exchange pattern, we don’t need solicit-response in our case

Set End Point Outbound Transport Type

WCF-Custom

This is the binding we are going to use.

Note: this value is not available in the ESB.TransportTypes vocabulary. Thus, we use literal string value “WCF-Custom”

Set Endpoint Outbound Transport Location

mssql://sqlservername//databasename?

This is standard form of the WCF-SQL uri. The example given is for default SQL instance (notice double slash)

Set End Point WCF Action

{Procedure/dbo/InsertPurchaseOrder}

This is from WCF-SQL adapter schema, but the trick here, it wants to be enclosed in {} which is not obvious

Set End Point Target Namespace

http://schemas.microsoft.com/Sql/2008/05

 

Set End Point Config

See below

That’s where “magic” is configured and deserves separate consideration

Endpoint configuration details

BindingType=sqlBinding&OutboundXmlTemplate=<InsertPurchaseOrder xmlns="http://schemas.microsoft.com/Sql/2008/05/Procedures/dbo"><messageBody><bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="string"/></messageBody></InsertPurchaseOrder>&OutboundBodyLocation=UseTemplate&BindingConfiguration=<binding name="sqlBinding" />

Parameter

Value

Notes

BindingType

sqlBinding

 

BindingConfiguration

<binding name="sqlBinding" />

Default binding configuration which can be augmented.

OutboundXmlTemplate

<InsertPurchaseOrder xmlns= http://schemas.microsoft.com/Sql/2008/05/Procedures/dbo>

<messageBody>

<bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="string"/>

</messageBody>

</InsertPurchaseOrder>

This is key parameter to make adapter accept the message and pass to stored procedure. The root element is the procedure name. The immediate child element is the procedure’s parameter. The enclosed element is to tell where to place message body.

OutboundBodyLocation

UseTemplate

Tells adapter to use template rather than raw message body.

This is another parameter which was not apparent since there’s no enumeration to provide possible values. Digging into adapter reference helps.

Add Messaging service to the Itinerary with the BRE endpoint resolver that uses policy created earlier. Then simply use one-way off-ramp. In the dynamic one-way port configuration PassThroughTransmit pipeline will do the job.

Once all these components implemented you have truly generic infrastructure to save any message to the database with minimal overhead. As new messages added, you simply create new stored procedure and rule that associate message type with it. And there are no BizTalk artifacts to deploy.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Sunday, September 11, 2011 #

I've been working lately on web application that uses Asp.Net MVC, WordPress and MySQL database. To communicate from .NET code to MySQL database using Entity Framework we installed MySql .NET Connector. It worked fine out of the box on developer's workstations but once deployed to hosted web server application started to throw following error:

[NotSupportedException: Unable to determine the provider name for connection of type 'MySql.Data.MySqlClient.MySqlConnection'.] System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInvariantName(DbConnection connection)
System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest)
System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName)
System.Data.Entity.Internal.Linq.InternalSet`1.Add(Object entity)
System.Data.Entity.DbSet`1.Add(TEntity entity)

Apparently, somehow MySQL .NET provider was not registered on server although installation was done properly and all assemblies were present in GAC. Since on shared hosting we did not have access to machine.config by adding the same registration entry to the application web.config file resolved the issue:

 

 <system.data> 
    <DbProviderFactories> 
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.4.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/> 
    </DbProviderFactories> 
  </system.data>

Important: 

1) Make sure to register the same version that is installed on the server

2) Provide precise fully qualified name in the type attribute. For example, adding extra space between MySql.Data.MySqlClient.MySqlClientFactory and MySql.Data will make this entry useless and will result in the same error

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Tuesday, January 04, 2011 #

Microsoft has released official hotfix related to the problem I described earlier (see: http://geekswithblogs.net/paulp/archive/2010/05/17/139876.aspx)

The knowledge base article and link to hotfix download are located at http://support.microsoft.com/kb/2300507/en-us

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Monday, January 03, 2011 #

Microsoft BizTalk Accelerator for HL7 comes with multiple versions of the HL7 implementation. One of the typical integration tasks is to receive one format and transmit another. For example, system A works HL7 v2.4 messages, system B with v2.3, and system C with v2.2. The system A is exchanging messages with B and C. The logical solution is to create schemas in separate namespaces for each system and assign maps on send ports. Schematic diagram of the messaging solution is shown below:

 

Nothing is complex about that conceptually. On the implementation level things can get nasty though because of the elaborate nature of HL7 schemas and sheer amount of message types involved. If trying to implement maps directly in BizTalk Map Editor one would quickly get buried by thousands of links between subfields of HL7 segments. Since task is repetitive because HL7 segments are reused between message types it's natural to take advantage of such modular structure and reduce amount of work through reuse. Here's where it makes sense to switch from visual map editor to old plain XSLT. The implementation is done in three steps.

First, create XSL templates to map from segments of one version to another. This can be done using BizTalk Map Editor subsequently copying and modifying generated XSL code to create one xsl:template per segment. Group all segments for format mapping in one XSL file (we call it SegmentTemplates.xsl). Here's how template for the PID segment (Patient Identification) would look like this:

<xsl:template name="PID">
    <PID_PatientIdentification>
      <xsl:if test="PID_PatientIdentification/PID_1_SetIdPatientId">
        <PID_1_SetIdPid>
          <xsl:value-of select="PID_PatientIdentification/PID_1_SetIdPatientId/text()" />
        </PID_1_SetIdPid>
      </xsl:if>
      <xsl:for-each select="PID_PatientIdentification/PID_2_PatientIdExternalId">
        <PID_2_PatientId>
          <xsl:if test="CX_0_Id">
            <CX_0_Id>
              <xsl:value-of select="CX_0_Id/text()" />
            </CX_0_Id>
          </xsl:if>
          <xsl:if test="CX_1_CheckDigit">
            <CX_1_CheckDigitSt>
              <xsl:value-of select="CX_1_CheckDigit/text()" />
            </CX_1_CheckDigitSt>
          </xsl:if>
          <xsl:if test="CX_2_CodeIdentifyingTheCheckDigitSchemeEmployed">
            <CX_2_CodeIdentifyingTheCheckDigitSchemeEmployed>
              <xsl:value-of select="CX_2_CodeIdentifyingTheCheckDigitSchemeEmployed/text()" />
            </CX_2_CodeIdentifyingTheCheckDigitSchemeEmployed>

. . . // skipped for brevity

This is the most tedious and time consuming part. Templates can be created for only those segments that are used in message interchange. Once this is done the rest goes much easier.

The next step is to create message type specific XSL that references (imports) segment templates XSL file. Inside this file simple call segment templates in appropriate places. For example, beginning of the mapping XSL for ADT_A01 message would look like this:

  <xsl:import href="SegmentTemplates_23_to_24.xslt" />
  <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />

  <xsl:template match="/">
    <xsl:apply-templates select="s0:ADT_A01_23_GLO_DEF" />
  </xsl:template>

  <xsl:template match="s0:ADT_A01_23_GLO_DEF">
    <ns0:ADT_A01_24_GLO_DEF>
      <xsl:call-template name="EVN" />
      <xsl:call-template name="PID" />
      <xsl:for-each select="PD1_PatientDemographic">
        <xsl:call-template name="PD1" />
      </xsl:for-each>
      <xsl:call-template name="PV1" />
      <xsl:for-each select="PV2_PatientVisitAdditionalInformation">
        <xsl:call-template name="PV2" />
      </xsl:for-each>

This code simply calls segment template directly for required singular elements and in for-each loop for optional/repeating elements.

And lastly, create BizTalk map (btm) that references message type specific XSL. It is essentially empty map with Custom XSL Path set to appropriate XSL:

In the end, you will end up with one segment templates file that is referenced by many message type specific XSL files which in turn used by BizTalk maps. Once all segment maps are created they are widely reusable and all the rest work is very simple and clean. 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Sunday, January 02, 2011 #

Repeating sequence groups can often be seen in real life XML documents. It happens when certain sequence of elements repeats in the instance document. Here’s fairly abstract example of schema definition that contains sequence group:
<xs:schemaxmlns:b="http://schemas.microsoft.com/BizTalk/2003"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns="NS-Schema1"
           targetNamespace="NS-Schema1" >
 <xs:elementname="RepeatingSequenceGroups">
    <xs:complexType>
      <xs:sequencemaxOccurs="1"minOccurs="0">
        <xs:sequencemaxOccurs="unbounded">
          <xs:elementname="A"type="xs:string" />
          <xs:elementname="B"type="xs:string" />
          <xs:elementname="C"type="xs:string"minOccurs="0" />
        </xs:sequence>
      </xs:sequence>
    </xs:complexType>
 </xs:element>
</xs:schema>
And here’s corresponding XML instance document:
<ns0:RepeatingSequenceGroupsxmlns:ns0="NS-Schema1">
 <A>A1</A>
 <B>B1</B>
 <C>C1</C>
 <A>A2</A>
 <B>B2</B>
 <A>A3</A>
 <B>B3</B>
 <C>C3</C>
</ns0:RepeatingSequenceGroups>
As you can see elements A, B, and C are children of anonymous xs:sequence element which in turn can be repeated N times. Let’s say we need do simple mapping to the schema with similar structure but with different element names:
<ns0:Destinationxmlns:ns0="NS-Schema2">
 <Alpha>A1</Alpha>
 <Beta>B1</Beta>
 <Gamma>C1</Gamma>
 <Alpha>A2</Alpha>
 <Beta>B2</Beta>
 <Gamma>C2</Gamma>
</ns0:Destination>
The basic map for such typical task would look pretty straightforward:
If we test this map without any modification it will produce following result:
<ns0:Destinationxmlns:ns0="NS-Schema2">
 <Alpha>A1</Alpha>
 <Alpha>A2</Alpha>
 <Alpha>A3</Alpha>
 <Beta>B1</Beta>
 <Beta>B2</Beta>
 <Beta>B3</Beta>
 <Gamma>C1</Gamma>
 <Gamma>C3</Gamma>
</ns0:Destination>
The original order of the elements inside sequence is lost and that’s not what we want. Default behavior of the BizTalk 2009 and 2010 Map Editor is to generate compatible map with older versions that did not have ability to preserve sequence order. To enable this feature simply open map file (*.btm) in text/xml editor and find attribute PreserveSequenceOrder of the root <mapsource> element. Set its value to Yes and re-test the map:
<ns0:Destinationxmlns:ns0="NS-Schema2">
 <Alpha>A1</Alpha>
 <Beta>B1</Beta>
 <Gamma>C1</Gamma>
 <Alpha>A2</Alpha>
 <Beta>B2</Beta>
 <Alpha>A3</Alpha>
 <Beta>B3</Beta>
 <Gamma>C3</Gamma>
</ns0:Destination>
The result is as expected – all corresponding elements are in the same order as in the source document. Under the hood it is achieved by using one common xsl:for-each statement that pulls all elements in original order (rather than using individual for-each statement per element name in default mode) and xsl:if statements to test current element in the loop:
 <xsl:templatematch="/s0:RepeatingSequenceGroups">
    <ns0:Destination>
      <xsl:for-eachselect="A|B|C">
        <xsl:iftest="local-name()='A'">
          <Alpha>
            <xsl:value-ofselect="./text()" />
          </Alpha>
        </xsl:if>
        <xsl:iftest="local-name()='B'">
          <Beta>
            <xsl:value-ofselect="./text()" />
          </Beta>
        </xsl:if>
        <xsl:iftest="local-name()='C'">
          <Gamma>
            <xsl:value-ofselect="./text()" />
          </Gamma>
        </xsl:if>
      </xsl:for-each>
    </ns0:Destination>
 </xsl:template>
BizTalk Map editor became smarter so learn and use this lesser known feature of XSLT 2.0 in your maps and XSL stylesheets.
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

In my project I needed to separate template generated entities, context in separate projects from the EDMX file. I’ve stumbled across this problem how to make template generator to find edmx file without hardcoding absolute path into the template. Using relative path directly (inputFile=@”..\ProjectFolder\DataModel.edmx”) generated error:
 
Error      2              Running transformation: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\ProjectFolder\DataModel.edmx'
 
The code that worked well for me when placed in the beginning of the .tt file:
 

string rootPath = Host.ResolvePath(String.Empty);
string relativePath = @"..\\ProjectDir\\DataModel.edmx";
string inputFile = Path.Combine(rootPath, relativePath);
EdmItemCollection ItemCollection = loader.CreateEdmItemCollection(inputFile);

 
 

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

If you experience sequence of errors below with BizTalk HL7 MLLP receive ports you may need to request a hotfix from Microsoft. Knowledge base article number is 2454887 but it’s still not available on the KB site. The hotfix is recently released and you may need to open support ticket to get to it. It requires three other hotfixes installed:
·         970492 (DASM 3.7.502.2)
·         973909 (additional ACK codes)
·         981442 (Microsoft.solutions.btahl7.mllp.dll 3.7.509.2)
If the exceptions below repeatedly appear in the event log you most likely would be helped by the hotfix:
Fatal error encountered in 2XDasm. Exception information is Cannot access a disposed object. Object name: 'CEventingReadStream'.
There was a failure executing the receive pipeline: "BTAHL72XPipelines.BTAHL72XReceivePipeline, BTAHL72XPipelines, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "BTAHL7 2.X Disassembler" Receive Port: "ReceivePortName" URI: "IPAddress:portNumber" Reason: Cannot access a disposed object. Object name: 'CEventingReadStream'.
The Messaging Engine received an error from transport adapter "MLLP" when notifying the adapter with the BatchComplete event. Reason "Object reference not set to an instance of an object."
We’ve been through a lot of troubleshooting with Microsoft Product Support and they did a great job finding an issue and releasing a fix.
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Wednesday, October 13, 2010 #

When developing pure messaging solutions (no orchestrations) in BizTalk often there’s a need to apply transformation on the message. BizTalk has out of the box functionality to execute maps on receive (inbound map) and send (outbound map) ports. Sometimes using classic BizTalk map is not the best solution, for example for complex transformations with grouping (for example, using Muenchian Method). In other cases, it’s strongly preferable to keep transformation easily configurable to be able to change it on the fly without overhead of deploying new map. Transformations using XSL stylesheet seems to fit that task very well.
 
One problem though, using standard .Net XML/XSL API won’t yield the best performance. Performance degradation will be especially noticeable in high throughput scenarious with large message size. BizTalk internally uses more efficient transformation API that is tuned for better performance for large messages. The classes that make this possible are VirtualStream (located in microsoft.biztalk.streaming.dll) and BTSXslTransform (located in Microsoft.xlangs.basetypes.dll). VirtualStream minimizes memory footprint by backing storage to file system.
 
Utilizing these classes I created generic pipeline component that can execute XSL transformation inside pipeline in a scalable fashion. As an additional feature it can be configured to execute standard BizTalk map.
 
Following configuration properties are available on the component:
 

 

Property
Values
Description
IsScalable
True | False
Indicates if transform should always be scalable
MapName
{XslUrl} | {BizTalk Map Name}
Defines the XSL URL or fully qualified map name to use for transformation
MessageType
{namespace}#{root}
Target message type
SchemaStrongName
{Class}, {Assembly}, Version={}, Culture={}, PublicKeyToken={}
Fully qualified .Net schema type name
TransformUsing
XslStylesheet | BizTalkMap
Indicates what kind of transformation is used
 
 
 
 
Source code with example project is available at http://www.box.net/shared/93p7n1vsl6
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Monday, May 17, 2010 #

When using WCF receive adapter with SQL binding in Polling mode please be aware of the following problem.

Problem:
At some regular but seemingly random intervals the application stops processing new requests, places a lock on the database and prevent other application from accessing it. Initially it looked like DTC issue, as it was distributed transaction that stalled most of the time.

Symptoms:
Orchestration instances in Dehydrated state, receive location not picking up new messages, exclusive locks on database tables, errors in DTC trace. You may see DTCXact transaction open when executing DBCC OPENTRAN. Other applications accessing the same tables may not be able to execute queries and return timeouts.

Reproduce:
Set up polling receive location in dedicated host instance. Set the polling interval to very small value to make effect noticeable (fro example 1 sec). Open performance monitor and add Process\ThreadCount$BTSNTSvc counters. Restart host instances and watch the counter for them. The one that hosts receive adapter will be adding one thread per second. On the screenshot below notice two host instances are adding threads very quickly comparing to other (on of themis highlighted white line). The steep break in line is host instance restart after reaching 100.

 

Cause:
Microsoft has confirmed that there is a bug in the WCF-SQL adapter that results in thread and memory leak. In the receive adapter binding configuration there's receiveTimeout property set to 10 minutes by default. If during this period data is not found in the table the adapter would start new thread and allocate more memory without releasing old resources. Thus if there's no new data in the table for a long time a new thread will be created in the host instance every 10 minutes until it reaches threshold (1000) and then there's no threads left for this host instance and it can't start/complete any tasks. Then this host instance won't be able to do anything. If other artifacts are hosted in the instance they will suffer consequences as well.

Solution:
- Set receiveTimeout to the maximum time 24.20:31:23.6470000.
- Place WCF-SQL receive locations in separate host to provide its own thread pool and eliminate impact on other processes
- Ensure WCF-SQL dedicated host instances are restarted at interval less or equal to receiveTimeout to flush threads and memory
- Monitor performance counters Process/Thread Count/BTSNTSvc{n} for thread count trend and respond to alert if it grows by restarting host instance

If you use WCF-SQL Adapter in the Notification mode then make sure to remove sqlAdapterInboundTransactionBehavior otherwise this location will exhibit the same issue. In this case though, setting receiveTimeout doesn't help and new thread will be created at default intervals (10 min) ignoring maximum setting.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Wednesday, October 14, 2009 #

BizTalk 2006 R2 Service Pack 1 Beta 1 has been released. It's available through MS Technology Adoption Program at https://connect.microsoft.com/site/sitehome.aspx?SiteID=65. List of features http://msdn.microsoft.com/en-us/library/ee532481(BTS.20).aspx.
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Thursday, August 27, 2009 #

Generally, it is not recommended to store passwords in the binding file and by default BizTalk administration UI clears it out when exporting binding to the xml file. But in development environment where you have automated continuous integration build and deployment not having password in the binding file will prevent application from starting and CI process fail. It can become tedious in staging deployments (TEST, UAT) as well, especially if you have multiple endpoints that use accounts with passwords. In such cases, having password for development account (hopefully not the same as production) in binding file can make life easier.

To do that, export binding file after application is fully configured. Open it and locate section(s) with configuration for the ports/locations of interest. For example for the WCF receive location it will be in:

<ReceiveLocationTransportTypeData>&lt;CustomProps&gt;...&lt;/CustomProps&gt;</ReceiveLocationTransportTypeData>

Find emtpy password tag in this section that will look like:

&lt;Password vt="1"/&gt;

Change it to enclose you password value and vt attribute value to "8":

&lt;Password vt="8"&gt;MyPassword&lt;/Password&gt;

Save and use this binding for an automated deployment script.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Tuesday, August 11, 2009 #

Recently, while debugging desktop client - WCF service application I came across this error:

System.ServiceModel.Security.MessageSecurityException was caught
Message=”An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.”
Source=”mscorlib”
StackTrace:
Server stack trace:
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

InnerException: System.ServiceModel.FaultException
Message=”An error occurred when verifying security for the message.”

Client was connecting basic http binding with security mode TransportWithMessageCredential. All other desktop clients were able to successfully call WCF service but not this particular one. Thanks to this post the issue was quickly understood and resolved. Apparently, the client machine was a brand new netbook just out of the box and clock was way off. Interesting thing that Windows automatic clock synchronization did not work.

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Thursday, July 02, 2009 #

Recently during migration BizTalk project from SQL to WCF adapter had some rather confusing moment. After deploying to test environment WCF ports started generate errors like this:

Failed to open Microsoft.ServiceModel.Channels.Common.Channels.AdapterRequestChannel, Faulted Microsoft.ServiceModel.Channels.Common.Channels.AdapterRequestChannel, Faulted System.ServiceModel.Channels.ServiceChannel, Failed to open System.ServiceModel.Channels.ServiceChannel

 After few frustrating troubleshooting sessions it was found that adapter binding was missing identifier for the default database instance. Here's what we had:

  Development Test
SQL port URI SQL://DevServer\DevInstance\Database SQL://TestServer/Database
WCF port URI mssql://TestServer/DevInstance/Database mssql://TestServer/Database

Both adapters worked in development, but in test WCF did not. What was missing is "//" between server and database part of the URI. This is not required for SQL adapter configuration but apparently is critical for the WCF adapter. So the correct URI should have been: mssql://TestServer//Database.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati