BizTalk Server WCF-Loopback Adapter

BizTalk Server WCF-Loopback Adapter

Unfortunately, some good BizTalk Server resources have disappeared over these years, and they are no longer available. A lot of these resources are custom adapters. One of these adapters was the BizTalk WCF Loopback Adapter initially developed by synthesis consulting (I think), providing back then the source code.

What is the WCF-Loopback Adapter?

The Loopback adapter is simply a two-way send adapter that, in its essence, returns a copy of the outbound message. This capability can be used in several situations or scenarios:

  • One of them is to replace the need to call pipelines inside an orchestration. Calling pipelines inside orchestrations is a good option, but it complicates the logic of the orchestrations with loops and expressions. You’ll also end up repeating the “code” for each message type/orchestration.
  • Atin Agarwal described another example in his blog: Simulating LOB Application using WCF LoopBack Adapter Binding in BizTalk.

The Loopback adapter gives you two opportunities:

  • To execute pipeline and maps on the way out
  • And when it comes back in without the overhead of some repository.

I was recently doing a proof-of-concept at a client, and I needed to invoke a receive pipeline inside the orchestration. That approach worked fine, but it feels like a static black hole that you don’t know is there, and if there is a need to apply any changes, you need to redeploy the orchestration. You cannot simply modify a setting on the pipeline. So, I decide to use the Loopback adapter to recreate the same experience implementing a different approach. Unfortunately, this adapter was no longer available for download, and all the references were wiped out from the face of the Earth. Luckily, I had some old print screens on my vast list of internal resources, and I decided to create a new version of this WCF adapter (king of re-creating) and make this WCF adapter available again.

It was also a good training experience to create a WCF Adapter.

How to install it?

This is a WCF adapter, so installing this adapter is the same as installing any other BizTalk Server WCF extension. And you have two options:

  • Using the machine.config files – This is the most complicated option, but it is the one I prefer to use;;
  • Or using the availability of registring WCF extensions on the receive and send handlers will not explain this approach.

You can choose to register this WCF adapter to run under 32-bit host instances, 64-bit host instances, or of course, both.

To install it, you need to:

  • Download the runtime folder from the WCF-Loopback Adapter GitHub page.
  • Install/register the Microsoft.BizTalk.WCFLoopback.Adapter.Runtime.dll in GAC
  • And add these settings of the machine.config files:
<system.serviceModel>
	<extensions>
		<bindingElementExtensions>
			<add name="WCFLoopbackAdapter" type="Microsoft.BizTalk.WCFLoopback.WCFLoopbackAdapterBindingElementExtension, Microsoft.BizTalk.WCFLoopback.Adapter.Runtime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5c92120f39ef9d11" />
		</bindingElementExtensions>
		<bindingExtensions>
			<add name="WCFLoopbackAdapterBinding" type="Microsoft.BizTalk.WCFLoopback.WCFLoopbackAdapterBindingCollectionElement, Microsoft.BizTalk.WCFLoopback.Adapter.Runtime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5c92120f39ef9d11" />
		</bindingExtensions>
	</extensions>
</system.serviceModel>
  • To run under 32-bit host instances
    • Open the machine.config present on the folder: C:WindowsMicrosoft.NETFrameworkv4.0.30319Config
    • I will also recomend, not mandatory, to change also the machine.config present on the folder: C:WindowsMicrosoft.NETFrameworkv2.0.50727CONFIG
  • To run under 64-bit host instances
    • Open the machine.config present on the folder: C:WindowsMicrosoft.NETFramework64v4.0.30319Config
    • I will also recomend, not mandatory, to change also the machine.config present on the folder: C:WindowsMicrosoft.NETFramework64v2.0.50727CONFIG

Restart the services.

Where can you use it?

This version available on GitHub is currently compiled on .NET 4.7.2 and optimized for BizTalk Server 2020. Nevertheless, you can take this code and compile it in other versions of .NET and BizTalk Server. It will be 100% compatible.

Download

THIS ADAPTER IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

You can download the BizTalk Server WCF-Loopback Adapter from GitHub here:

The post BizTalk Server WCF-Loopback Adapter appeared first on SANDRO PEREIRA BIZTALK BLOG.

BizTalk Server WCF-* Adapter: Please verify that the receive location exists, and that the isolated adapter runs under an account that has access to the BizTalk databases.

BizTalk Server WCF-* Adapter: Please verify that the receive location exists, and that the isolated adapter runs under an account that has access to the BizTalk databases.

I think in the past I told that do not try to configure anything in BizTalk Server if you are tired. My advice, go to sleep for one hour and come back… unless the client is eager and demands or request things to be done… then the error happens. This was one of these errors in which I usually say that the problem was between the chair and the keyboard. This week I returned to work, after my little honeymoon leave, that I spent part of it working and another part of it with my little kid a little sick (I need to compensate my wife with a proper vacation for being so understanding). So, as you can imagine I return a little tired and the first day was one of those days that I had several clients requiring my presence for several small things at the same time.

One of them was configuring correctly, according to best practices and security the IIS application pools that were being used to run Web Sites with some orchestrations exposed as Web Services that initial was running with BizTalk Server Administration account.

Once I finished configuring the applications pools, I started receiving the following error:

The Messaging Engine failed to register the adapter for “WCF-WebHttp” for the receive location “/ModifyOperationStatus/ModifyOperationStatus.svc”. Please verify that the receive location exists, and that the isolated adapter runs under an account that has access to the BizTalk databases~

BizTalk Server WCF-* Adapter: Please verify that the receive location exists, and that the isolated adapter runs under an account that has access to the BizTalk databases.

Cause

Usually, this can happen for two reasons:

  • There isn’t a receive location created and enabled listening to this web service;
  • Or this is a permission issue! And is typically related by the fact that the account or service account specified on the application pool that the web service is running is not… a member of the BizTalk Isolated Host Users group.

In my case, and because the names of the service accounts were very identical, I improperly configured the application pool to run with the service account that was a member of the BizTalk Host Users group (btsapphostsrv) instead of the service account member of the BizTalk Isolated Host Users group (btsiapphostsrv).

Solution

To solve this issue, you first should check and double-check if the IIS Application Pool Identities are correctly configured.

If yes, guarantee that the user or service account is part of the BizTalk Isolated Host Users group. If not:

  • Make sure you add that user or service account into the BizTalk Isolated Host Users group.
  • Or change the IIS Application Pool Identity for an account that is already a member of the BizTalk Isolated Host Users Group.

And then make sure that there is a receive location configured and to listen to this web service and if it is enabled.

 

In my case, changing to the BizTalk Isolated Host Instance Account that is, of course, a member of BizTalk Isolated Host Users group solved my issue.

The post BizTalk Server WCF-* Adapter: Please verify that the receive location exists, and that the isolated adapter runs under an account that has access to the BizTalk databases. appeared first on SANDRO PEREIRA BIZTALK BLOG.

BizTalk WCF-SQL Error: Microsoft.ServiceModel.Channels.Common.ConnectionException: Login failed for user

BizTalk WCF-SQL Error: Microsoft.ServiceModel.Channels.Common.ConnectionException: Login failed for user

And yes, this is just another “Login failed for user” SQL Server WCF-Adapter related error. In the past I wrote about a similar topic BizTalk WCF-SQL Error:

This time the error message, the cause, and the solution are slightly different. This time while trying to communicate to a brand-new SQL Server server/database to insert date on a table thru BizTalk WCF-SQL adapter I got the following error:

Microsoft.ServiceModel.Channels.Common.ConnectionException: Login failed for user ‘BTSHostSrvc’. —> System.Data.SqlClient.SqlException: Login failed for user ‘BTSHostSrvc’.

at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)

at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)

at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection.

BizTalk Server WCF-SQL: Login failed for user

In the event viewer the message is pretty much the same:

A message sent to adapter “WCF-Custom” on send port “STAGING_BULK_SQL_WCf_SEND” with URI “mssql://SQLSRV/ /ESBAsync” is suspended.

Error details: Microsoft.ServiceModel.Channels.Common.ConnectionException: Login failed for user ‘DOMAIN BTSHostSrvc’. —> System.Data.SqlClient.SqlException: Login failed for user DOMAIN BTSHostSrvc’.

at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)

at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)

at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)

at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)

at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)

at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)

at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)

at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)

at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)

at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)

at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)

at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)

at System.Data.SqlClient.SqlConnection.Open()

at Microsoft.Adapters.Sql.SqlAdapterConnection.OpenConnection()

— End of inner exception stack trace —

Server stack trace:

at Microsoft.Adapters.Sql.SqlAdapterConnection.OpenConnection()

at Microsoft.Adapters.Sql.ASDKConnection.Open(TimeSpan timeout)

at Microsoft.ServiceModel.Channels.Common.Design.ConnectionPool.GetConnection(Guid clientId, TimeSpan timeout)

at Microsoft.ServiceModel.Channels.Common.Design.ConnectionPool.GetConnectionHandler[TConnectionHandler](Guid clientId, TimeSpan timeout, MetadataLookup metadataLookup, String& connectionId)

at Microsoft.ServiceModel.Channels.Common.Channels.AdapterRequestChannel.OnOpen(TimeSpan timeout)

at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)

at Microsoft.BizTalk.Adapter.Wcf.Runtime.OneWayOperationSendPortRequestChannel`1.OnOpen(TimeSpan timeout)

at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)

at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)

at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)

at System.ServiceModel.Channels.CommunicationObject.Open()

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)

at System.ServiceModel.ICommunicationObject.Open()

at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.GetChannel[TChannel](IBaseMessage bizTalkMessage, ChannelFactory`1& cachedFactory)

at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendMessage(IBaseMessage bizTalkMessage)

MessageId: {84B22A22-13F7-47C7-91B5-A863E64E268E}

BizTalk Server WCF-SQL: Login failed for user

Cause

Once again, sometimes is not quite true, the cause of the problem is simple to diagnose, and the error message gives a very good intel in the cause of the problem.

This problem occurs because the user account that you used to access the database, in my case the BizTalk Host Instance Account, don’t have permissions to connect… the SQL Server or SQL Server instance.

Just to be clear, this is not having permission to insert, read or event full permission to do operation on a specific database, that is completely different – I check all of that and the user have the correct access/permission. What I forget was to give access to connect to the SQL Server/SQL Server Instance.

Solution

To solve this issue, you must give access to the user, in my case BizTalk Host Instance Account to connect to the SQL Server and for that, you must:

  • Open SQL Server Management Studio and connect to your server.
  • In the Object Explorer, expand the “Security” folder under the server.
  • Right click on the “Logins” folder and choose “New Login…”
  • Add the username or group in the format “DomainUserNameOrGroup”

03-WCF-SQL-Receive-Location-Login-Failed-For-user-Create-SQL-Server-Login

  • Choose the “Securables” tab and make sure that you grant “Connect SQL” permission to the SQL Server/SQL Server instance

04-WCF-SQL-Receive-Location-Login-Failed-For-user-Create-SQL-Server-Login-Securables

  • Click “OK” and your user will be created and have access to connect to your SQL Server.
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community. View all posts by Sandro Pereira

The BizTalker Volume 12 – Sending to a WCF Receive Adapter

Last week I released volume 12 of The BizTalker.  This issues’ feature article was written by Dwight Goins of QuickLearn and talks about working with the WCF Adapter in BizTalk 2006 R2. 

Also covered is the new BizTalkBlogs.com and the new training available on BizTalk-Training.com

You can view the newsletter online or to make sure you don’t miss out simply subscribe!

Advanced Microsoft BizTalk 2006 R2 Concepts Slides and Demos

These are the slides and demos from my Tech Ed Session from Tech Ed 2007 in Orlando.   

The demos show Dynamic Mapping, Self-Correlation Ports, Untyped Messages, and WCF Calls in Messaging.  The WCF demos will require BizTalk Server R2.  These demos are “as is” and may need some configuration changes to work on your system.

PowerPoint 2007 is required to view the slides.

Session Abstract:

“Business processes are a required component in most Enterprise Integration solutions today. Business processes are modeled, designed, and built inside BizTalk Server 2006 R2 using Orchestrations. Orchestration can range from a few simple shapes to a complex multi Orchestration, Transactional process. This session focuses on highlighting key Orchestration features to shorten development time and increase overall Business Process reusability. Also, messaging-only scenarios using WCF are discussed, and the power of BizTalk as a Web service routing system is shown. Topics covers are: Untyped Messages, Dynamic Transforms, Starting Orchestration and Passing Port Parameters, using Helper .NET Components, and Message Only WCF Calls.

First Look at the WCF Adapter WCF Sample Code

This sample shows a basic WCF Service using Basic HTTP Binding. This service is hosted inside IIS and uses a WCF Receive Location to process WCF messages inside BizTalk.

This code was built using a beta version of BizTalk 206 R2.  The concepts are the same in the RTM release of BizTalk 2006 R2 but this code may not work.

Watch the video related to this sample here: http://www.biztalkgurus.com/biztalk_server/biztalk_2006_r2/m/biztalk_2006_r2_samples/32391.aspx

First Look at the WCF Adapter in BizTalk 2006 R2 Video

Note: This video is based on BizTalk Server 2006 R2 BETA

This nearly 13 minute video gives a quick, high level First Look at BizTalk Server 2006 R2 WCF Adapter using the Basic HTTP Binding. This is intended to show how easy it is to use BizTalk 2006 R2 and WCF to build applications.

Note that this is based on Beta code and is subject to change in future releases.

This content should be current for the RTM release of BizTalk 2006 R2 and beyond.