How do you configure a BizTalk WCF-SQL adapter to

2019-05-10 17:19发布

问题:

We have a client that is going to use the AlwaysOn Availability feature of SQL Server 2012. They want to have the BizTalk WCF-SQL port connect to the read-only replica.

The documentation on the subject say that the connection has to be made to the SQL Server 2012 Availability Group Listener, and the connection has to be able to set the “ApplicationIntent” parameter. This tells the SQL Listener that the connection is a read-only intent connection, and that it should be redirected to a readable secondary replica. Without that working the connection will be made to the primary database which is not what is wanted.

How do you configure the “ApplicationIntent” parameter on a BizTalk WCF-SQL adapter?

回答1:

There is no way of doing this via the WCF-SQL adapter. We have had to go with an external helper class to create the connection with a connection string and query the database.

Update: A Blog written by a colleague on the issue Can I use a BizTalk WCF-SQL send adapter with a SQL 2012 Always on Database? a snippet quoted below.

In summary I think your choices are (in order of preference):

  • Disable AlwaysOn Availability Groups / Mirroring on SQL server if you need to connect to this SQL server which has this enabled

  • Disable transactions and implement logic to be able to handle duplicates .

  • Disable transactions and handle the duplicates or lost messages with custom logic (e.g. Send twice and compare and implement error handling). You need to write your own DTC handling this which is probably very complicated.

  • Disable transactions and live with risk of duplicates or lost messages without handling duplicates.



回答2:

I think you'll need to go WCF-Custom + sqlBinding to specify a connection string.



回答3:

In that link you gave, they did it in the connection string. Look at the last item in it:

Server=tcp:AGListener,1433;Database=AdventureWorks;
IntegratedSecurity=SSPI;ApplicationIntent=ReadOnly

Looks easy enough...