Overcoming WinSCP Assembly Issues in BizTalk 2016

Recently I was having issues on BizTalk 2016 getting the SFTP adapter to work correctly. I had followed all of the steps listed at Michael Stephenson’s blog entry here, but I was still getting this error:

A message sent to adapter “SFTP” on send port “<send port name>” with URI “sftp://<port URI>” is suspended.
Error details: System.TypeLoadException: Could not load type “WinSCP.RemotePath” from assembly “WinSCPnet, Version=, Culture=neutral, PublicKeyToken=…”

I made sure nothing was GAC’ed and the correct version of the dll was in the BizTalk program files folder, but still I had this error.

I was able to add a reference to the dll that had this version in a project and in the object browser it showed that the RemotePath type did not exist in the dll file. I checked on Nuget for WinSCP but could not find a version that matched and had the RemotePath type in it.

Here is my solution:

  1. I downloaded the absolute latest version from the Nuget WinSCP site. When running Michael’s script it downloads an older version of the dll. I installed the absolute latest version and then copied the WinSCP.exe and WinSCPnet.dll files from the C:\Program Files (x86)\WinSCP folder to the BizTalk program files folder just like the script does. For me the files had version
  2. Then I added an assembly binding redirect to the BizTalk config files (what I added is between the dependentAssembly tags in purple):
   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="BizTalk Assemblies;Developer Tools;Tracking;Tracking\interop" />
        <assemblyIdentity name="WinSCPnet" publicKeyToken="2271ec4a3c56d0bf" culture="neutral" />
        <bindingRedirect oldVersion="" newVersion="" />


This binding redirect ensures that a version of the WinSCP code runs that has the RemotePath type when the version is invoked. It appears the BizTalk SFTP adapter was bound to this version but I could not find a version that had the RemotePath type.

I updated both the BTSNTSvc.exe.config and the BTSNTSvc64.exe.config files and restarted the host instances.

Note: I noticed that the BizTalk 2016 CU 7 updated its support for WinSCP to a newer version so after applying the cumulative update the BizTalk SFTP adapter will be referencing a new version of WinSCP so you may not need this any longer after CU 7.

BizTalk PowerShell Provider officially updated

A few days ago I blogged that I had put together an unofficial update to the BizTalk PowerShell Provider. I joined up with the project on CodePlex and they put me to work quick!

Tonight I checked in some updates and now we have a new release,, which works on BizTalk 2013. I will be taking down the link for the unofficial release now. Please try it out and report any issues on the CodePlex site.

Please let me know if you have any suggestions for new cmdlets. I have a couple ideas I am going to be working on and will also be working on expanding the documentation and examples. I am also interested in making some cmdlets that work with the BizTalk Services components of Windows Azure.


BizTalk PowerShell Add-In updated for BizTalk 2013

I was working on building out the BizTalk 2013 environments for a client when one of the guys in IT mentioned that the BizTalk PowerShell snap-in was not updated for working with BizTalk 2013. The CodePlex site at http://psbiztalk.codeplex.com/ mentions the currently released version only works on BizTalk 2010.

So I downloaded the source and rebuilt from my BizTalk 2013 VM. I only had to go through the migration wizard and install WiX to get all of the projects to build. Then I ran the installer and started using it from a PowerShell prompt. It appears to be working fine to me. I uploaded the file as PSBizTalk BizTalk 2013 Verison 0.1 to my SkyDrive. (update: I updated the provider officially on CodePlex. Please go to the release page).

I did not increment the version information or do anything else you might expect would be done, just rebuilt it into the MSI so you can use it in your BizTalk applications. Please let me know if you try out the updated version and if there are any issues.


Ben Cline

BizTalk 2013 RTM is out now!

The latest full version of BizTalk was released yesterday to MSDN. Here is the official announcement: http://blogs.msdn.com/b/biztalk_server_team_blog/archive/2013/03/21/biztalk-server-2013-is-now-rtm.aspx. General availability is coming up soon.

I downloaded the Standard edition from MSDN yesterday but the Developer edition has not made it to MSDN yet.

There are many new and improved features but the ones I am most excited about are the improved ones. The new features are primarily around updates to the platform for working with the cloud and working with the latest versions of the underlying technologies and tool versions.

A comprehensive list of the updates is available at: http://blogs.msdn.com/b/nitinme/archive/2012/11/15/biztalk-server-2013-beta-what-s-new.aspx. Microsoft has done a good job of continuing to release updates for BizTalk through the cumulative updates. But there are often things about the product that you wish could change. In the 2013 release there are many updates that fix some of these architectural annoyances.

For example, dynamic send ports have always run under the default host for the adapter which led to unusual errors and problems when different hosts have separate accounts. I once worked for a customer that wanted to reduce the attack surface of his BizTalk hosts by running each one under a separate account. Unfortunately the customer used dynamic send ports extensively and these all executed under the same account across all of the BizTalk applications. This behavior was a problem because we had to set NTFS permissions on the paths the dynamic send port used but kept using the wrong account to set this. This problem has been overcome in the 2013 release.

Another improvement in the new product is the ESB toolkit is now part of the main product and there are much fewer steps to deploying the ESB Toolkit. In BizTalk 2010 the ESB Toolkit setup often took a full day to a couple days to setup properly unless you scripted it yourself. Having the toolkit baked into the main product is a real time saver and will make it easier to deploy BizTalk solutions.

It is great to see the new version of BizTalk because it is a reminder of Microsoft’s long-term commitment to BizTalk customers.

Workaround for Kerberos SSPI Context Errors in BizTalk

A couple weeks ago one of my clients was experiencing constant “Cannot generate SSPI Context” errors in BizTalk. These are Kerberos errors and they are extremely annoying because they happen constantly whenever you are trying to use any database function with BizTalk. These would fill up the event logs on my client’s server and was a huge time waster because they would prevent me from doing just about anything with BizTalk.  I would receive these errors when trying to start a host or change almost anything in the BizTalk admin console. I think the source of the problem is that something about the domain membership was different than some of the accounts on the server and this led to Kerberos authentication problems.

As a temporary fix I was able to restart the BizTalk server but the errors eventually came back again. The errors basically paralyze a BizTalk server and they are complicated to diagnose and sometimes you just do not have enough time to do diagnostics – like in a production environment. The fix provided next is similarly a workaround, it does not solve the root problem but at least provides another way to get the server working.

To attempt to resolve the problem, I tried a couple different things such as removing the server from the domain and adding it back in, but none of these things were successful at removing the problem completely. I did also try switching my Enterprise Single Sign On account and master key but this did not conclusively solve the problem.  I was looking at the article at http://support.microsoft.com/kb/811889 and tried some of the suggestions but was not getting anywhere. Then I tried disabling TCP/IP for SQL connections and just use named pipes based on using SQL Configuration Manager or the SQL Network Configuration tool. TCP/IP seemed like such a fundamental protocol that I was not optimistic the problem would go away by switching protocols, but it worked for me. Many people also think that named pipes only works on a single server and functions like IPC but this is not exactly right.

My use of this workaround was on BizTalk 2010, W2K8 R2, with SQL 2K8 R2 when SQL is on a separate server than BizTalk.

The KB article above solely mentions this workaround in the context of SQL and Kerberos so I am blogging that this fix is working for me on my BizTalk server too. ‘


CRM 4 adapter works with BizTalk 2010

A couple months back I did a test for a client about whether the legacy Dynamics CRM 4 adapter would work successfully on BizTalk 2010. I know this is not the recommended configuration and that the CRM 2011 SDK does not mention this as an acceptable or supportable configuration. Many companies have made a significant investment in CRM 4 and may not be able to upgrade their CRM software. So I am just putting this information out there in case you are wondering.

Others have reported needing to use a registry workaround for getting the adapter to install for BizTalk 2009: http://geekswithblogs.net/BizTodd/archive/2009/05/12/132058.aspx. I followed this workaround with BizTalk 2010 on Windows Server 2008 R2 and it worked fine. The CRM 4 adapter install worked fine. I was also able to run the schema creation wizard in VS 2010.

I did not try running the software in this configuration in a production environment and have not tested this configuration completely. But usually in my experience if the install works fine and the designers still work in VS then you can probably work with this configuration, if only for a temporary workaround while you create a migration strategy.


BizTalk LOB book complete in April 2011

I have been working as a technical reviewer for a book that will be complete in April 2011 called BizTalk  2010 Line of Business Systems Integration from Packt Publishing. Pre-order is now available for the print form but some of the individual chapters are available now. Please check out this link for more information about the book: https://www.packtpub.com/microsoft-biztalk-2010-line-of-business-systems-integration/book.

It provides useful documentation of integration with Dynamics AX and CRM as well as various cloud-based services. The SAP chapters are very valuable and extend the currently available MSDN documentation for  BizTalk integrations with SAP. This book would be an excellent supplement to your technical library. Thanks

BizTalk 2010 certification coming soon

I saw today that the BizTalk 2010 certification details were posted at http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-595&Locale=en-us#tab2. According to the article the exam will be available at the very end of March 2011. I know many people in the BizTalk community have been eager for another BizTalk certification test so the good news for everyone is that Microsoft listened and made this new exam. Good luck everybody!

Sorry for such a short post, I could have worked it into a tweet. Thanks

Time saving PowerShell Snippets for BizTalk Part 1

Some of the beauty of using PowerShell is the ability to rapidly do things that would take a long time to do in .NET code. But you can do this without opening Visual Studio. I have found many uses for PowerShell in working with BizTalk. One area it comes in handy is working with BizTalk binding files. I know you can just use the ExplorerOM but this is painful due to its 32-bit limitations. A frequent pain-point in deploying across environments is needing to create external artifacts for supporting your BizTalk ports.

So for example you use MSMQ and need to create all the queues that your ports refer to. Or directories for all the FILE ports you use. It is nice to just include some more PowerShell to handle this and just rest assured the external artifact will get created when you deploy your BizTalk updates. In my PowerShell code below it handles creation of folders. Enjoy!


$newroot = ""

if($rootCreatePath -ne "") {
    $rootCreatePathExists = [io.file]::Exists($rootCreatePath)

    if($rootCreatePathExists -eq $true) {  $newroot = $rootCreatePath }
    else {

        Write-Host "Creating directory" $rootCreatePath

        $newroot = $rootCreatePath


$bindingFileExists = [io.file]::Exists($pathToBindingsFile)

if($bindingFileExists -eq $true) {
    # Read in the binding file content
    $bindingContent = [xml](Get-Content $pathToBindingsFile)
    $bindingContent.SelectNodes("//PrimaryTransport") | ForEach-Object {
        # Only process if the port type is FILE
        if ($_.TransportType.Name -eq "FILE") {
            $directory = [io.path]::GetDirectoryName($_.Address)
            # replace with rootCreatePath if this value exists
            if ($newroot.Trim() -ne "") {
                $directory = $directory.Replace($defaultRoot,$newRoot)
            # Check if the directory exists
            $directoryExists = [io.directory]::Exists($directory)
            if ($directoryExists -ne $true) {
                Write-Host "New directory:" $directory
else {
    Write-Host "Binding file does not exist:" $pathToBindingsFile

Blog at WordPress.com.

Up ↑