Archive

Archive for the ‘BizTalk Server’ Category

ESB Toolkit overrides BizTalk config (BTSNTSvc.exe.config)

February 17, 2014 1 comment

I’ve setup a BizTalk Server 2013 environment with ESB Toolkit 2.2 and since I use Enterprise Library for logging I also updated the BTSNTSvc64.exe.config file, but when I tried to run a sample application it throws an error:

Activation error occured while trying to get instance of type LogWriter, key “”:Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type LogWriter, key “” —> Microsoft.Practices.Unity.ResolutionFailedException: Resolution of the dependency failed, type = “Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter”, name = “(none)”.

Exception occurred while: while resolving.

Exception is: InvalidOperationException – The type LogWriter cannot be constructed. You must configure the container to supply this value.

Apparently, ESBToolkit is overriding the BizTalk configuration.

Solution:

Move the configuration to <ESB Toolkit Installation Folder>\esb.config file.

Categories: BizTalk Server

BizTalk: How to fix regional settings problem (decimal number formatting)

September 3, 2012 Leave a comment

The regional settings of the operating system wherein your BizTalk Server is hosted, affects how the numbers/date are formatted. This in some cases, becomes a problem when trying to insert data in SQL Server using WCF-SQL.

For instance if the server is setup to use Dutch regional settings, the decimal number is separated by (,) comma. When you try to insert a data for instance 10.001, it becomes 10001. To fix the problem, you need to change the regional settings of the service account wherein the host instance is running.

Basically there are two things you can do.

One is to logon the account -> Go to regional settings -> Change the number formatting.

Now, if it’s impossible to login the account, you can fix it by changing the registry settings, for this you need the SID of the user account.

Updating Regional settings of an account using registry:

1. Open Regedit.

2. To get the SID, navigate to HKLM\SOFTWARE\Microsoft\Windows NT\ProfileList

Browse to every folder below and using the value in ProfileImagePath, you can determine the correct user account.

Then use the SId of the folder.

3. Once you have the GUID, browse to: HKEY_USERS\<SID in step 2>\Control Panel\International

Change the string values, for Decimal, change the sDecimal value.

 

BTDF: System.OutOfMemoryException while deploying using Powershell Remoting

July 17, 2012 Leave a comment

Recently when I tried to deploy a BizTalk solution packaged with BTDF (BizTalk Deployment Framework) in combination with Powershell Remoting I encountered this error:

Error: Failed to add resource(s).

Change requests failed for some resources.

BizTalkAssemblyResourceManager failed to complete end type change request.

Exception of type ‘System.OutOfMemoryException’ was thrown.

 

I checked the memory on the remote server and even restarted it but it didn’t help, I still encounter this error.

As it turns out, as well as I’ve suspected it’s the memory of the powershell. To increase the size of the memory, run the PowerShell Command prompt on the target server and enter the ff:

Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 512

Or set it even to higher.

 

 

Interviewed by Steef-Jan Wiggers (BizTalk MVP)

June 20, 2012 1 comment

I would like to thank Steef-Jan for taking his time and posting my interview on his site:

http://soa-thoughts.blogspot.nl/2012/06/biztalk-community-series-introducing.html

 

BizTalk Property Promotion : MessageDataPropertyBase vs MessageContextPropertyBase

When adding a property schema that can either be used for content-based routing (CBR) or just to hold metadata information about a message in BizTalk we are confronted which Property Schema Base to use:

1. MessageDataPropertyBase
2. MessageContextPropertyBase or
3. PartContextPropertyBase

Answer is quite simple:

If the promoted property can be found in the source (incoming) message you need to use MessageDataPropertyBase.

If the property can be set in envelop, pipeline or manually promoted in the orchestration using Correlation Sets then MessageContextPropertyBase is used.  This is also a useful technique if we want to maintain the original structure of the message and at the same time inject some properties that can be used in tracking or routing.

Lastly, suppose if I have a source message without a namespace and I need to map it to my internal schema with promoted properties how will I do it?

1. Create a custom receive pipeline with Set Namespace in Component in Decode Stage. Add an XML Disassembler with schema equals to the source schema with the expected namespace.

2. Add a Map, map source to internal schema (this should contain attribute/fields that will be promoted).

3. Add a Property Schema, question is, which Property Schema based to use?

4. Update internal schema to map the fields to promoted properties.

Note: I used  MessageContextPropertyBase in Step # 3 and it works.

BizTalk Archiving – SQL and File Documentation

February 13, 2012 5 comments
I moved the documentation from: http://biztalkarchiving.codeplex.com/documentation, since it’s unreadable on the site.
 

BizTalk Archiving SQL and File Documentation

 

Installation

  1. Run MSI installer
  2. Install it on <Program Files>\BizTalk Server 2010\PipelineComponents.
  3. Go to <Program Files>\BizTalk Server 2010\PipelineComponents\BizTalkMsgArchiveScripts folder, execute RegisterSource.cmd (As administrator), this will register the source so that the pipeline can log to the event log.

Usage – Design Time – VS2010

  1. Open VS2010 -> Create new BizTalk Project -> Add Receive Pipeline
  2. Right Click ToolBox -> Choose Items
  3. Go to BizTalk Pipeline Components -> Check BizTalk Message Archiving Component
  4. New Pipepline Added to the toolbox.
  5. Drag & Drop the BizTalk Message Archiving Component to Decode Stage.
  6. Configure Properties (see Configuration)

Note: You can also configure the Properties using BizTalk Administration Console.

Setup – SQL Archiving

Since the archiving will use an SQL Database, you’ll need to create the database and table.

  1. Go to <Program Files>\BizTalk Server 2010\PipelineComponents\BizTalkMsgArchiveScripts folder.
  2. Execute the CreateDatabase.sql on the target database server. This will create the database named: BizTalkArchiveDb, table named: Messages and stored procedure named: InsMessages

Configuration

  1. Deploy the pipeline that uses the BizTalk Message Archiving Component (See Usage – Design Time – VS2010)
  2. Using BizTalk Administration Console, create a new Receive Location and use the pipeline on previous number, on the pipeline click the Elipsis .. to display properties.
Property Name Description Use In Sample Values Notes
CompressionPassword Password that will be used in zip file File & SQL Archiving P@ssw0rd
DbConnProvider Connection Provider SQL Archiving System.Data.SqlClient
DbConnStr Database connection string SQL Archiving Data Source=localhost;Initial Catalog=BizTalkArchiveDb;Integrated Security=SSPI; Using integrated security you need to grant the identity of the host wherein the receive/send port is binded permission to BizTalkArchiveDb with ff roles: dbdatareaderdatawriter, db and execute permission on the stored procedure InsMessages
DbFileExtensions File extension to be used SQL Archiving .xml
DbPropList This is a set of delimited values of name & namespace of message context properties that will be passed to the stored procedure to be used for custom logging. SQL Archiving ReceivedFileName;http://schemas.microsoft.com/BizTalk/2003/file-properties|ReceivedPortName;http://schemas.microsoft.com/BizTalk/2003/system-properties Format is Property Name;Namespace and for multiple values the delimiter is ‘|’ pipe symbol.
DbSPName Stored procedure name SQL Archiving Built-In: InsMessages The stored procedure can be customized as long as it has the same signature with the default one. For instance, there can be additional logic to parse the Message Properties and insert it into the new custom table
FileArchiveBackFolder Folder / Shared Location / Network location wherein the files will be archived File Archiving \\RPaulo2011\Test\Archive If it’s a shared folder the pipeline will try to use first the identity of the host, if it failed it will use the credentials supplied (see FileArchive UserName, Password, Domain)
FileArchiveFileName Name of the archive file File Archiving %SourceFileName%_%datetime% Supported macros are: – %SourceFileName%, %MessageID%,%datetime%, %time%
FileArchiveIsOverwriteFiles Overwrite Flag File Archiving True
FileArchiveUserDomain Domain name of user credentials File Archiving PAULOR This values will be used if the identity of the host instance doesn’t have permission on the backup folder.
FileArchiveUserName User name File Archiving BizTalkUser This values will be used if the identity of the host instance doesn’t have permission on the backup folder.
FileArchiveUserPwd Password File Archiving P@ssword This values will be used if the identity of the host instance doesn’t have permission on the backup folder.
IsArchiveToDb Archive to database flag SQL Archiving True True = Archive to database, False = Disabled
IsArchiveToFile Archive to file flag File Archiving True True = Archive to file, False = Disabled
IsCompressFile compress file flag SQL & File Archiving True True = Compress the file, False = No compression, It uses DotNetZip

Usage – Downloading Archive Files using ASP.NET

https://randypaulo.wordpress.com/2011/06/21/storing-files-to-database-and-downloading-using-asp-net/

Automating\Silent Installation of BizTalk Deployment Framework (BTDF) using Powershell

January 31, 2012 37 comments

To do a silent install/automate the installation of BizTalk Application using BizTalk Deployment Framework you can use the Powershell script below:


<#
.SYNOPSIS
 Automates BizTalk Application deployment using BTDF 5.0

.DESCRIPTION
 Automates BizTalk Application deployment using BTDF 5.0
  Steps:
   1. It installs the MSI on the specified application path
   2. Calls EnvironmentSettingsExporter to generate the settings xml
   3. Updates Environment Variables
   4. Executes the MSBuild with parameters

.NOTES
 File Name: Install-BizTalkApplication.ps1
 Author: Randy Aldrich Paulo
 Prerequisite: Powershell 2.0, BizTalk Deployment Framework 5.0, BizTalk Server 2010

.PARAMETER MsiFile
 MSI File generated using BizTalk Deployment Framework 5.0

.PARAMETER ApplicationInstallPath
 Location wherein the resource files will be copied, it will be use by the BTDF during the deployment

.PARAMETER Environment
 Name of environment (Local,Dev,Test,Prod) to be used, this value will be passed to
 EnvironmentSettingsExporter and willbe used to construct the environment variable: ENV_SETTINGS

.EXAMPLE
 Install-BizTalkApplication -MsiFile "E:\Installer\Application 1\Application1.msi"
 -ApplicationInstallPath "E:\Program Files\Application 1"
 -Environment DEV

.EXAMPLE
 Install-BizTalkApplication -msi "E:\Installer\Application 1\Application1.msi"
 -path "E:\Program Files\Application 1"
 -env TEST

.EXAMPLE
 Install-BizTalkApplication "E:\Installer\Application 1\Application1.msi"
 "E:\Program Files\Application 1" TEST

.EXAMPLE
 Install-BizTalkApplication "E:\Installer\Application 1\Application1.msi"
 "E:\Program Files\Application 1" TEST -SkipUndeploy $false

#>
function Install-BizTalkApplication
{
 param(
  [Parameter(Position=0,Mandatory=$true,HelpMessage="Msi file should be existing")]
  [ValidateScript({Test-Path $_})]
  [Alias("msi")]
  [string]$MsiFile,
  
  [Parameter(Position=1,HelpMessage="Path wherein the resource file will be installed")]
  [Alias("path")]
  [string]$ApplicationInstallPath,
  
  [Parameter(Position=2,Mandatory=$true,HelpMessage="Only valid parameters are Local,Dev,Test and Prod")]
  [Alias("env")]
  [ValidateSet("Local","Dev","Prod","Test")]
  [string]$Environment,

  [bool]$BTDeployMgmtDB=$true,
  [bool]$SkipUndeploy=$true
  )

 $ErrorActionPreference="Stop"

 #Step 1 : Run MSI 
  $script =
  {
      $args = "-i $MsiFile INSTALLDIR=`"$ApplicationInstallPath`" /qn /norestart"
   Write-Host " Installing MSI File.." -ForegroundColor Cyan
   Write-Host "  MSI File: $MsiFile" -ForegroundColor DarkGray
   Write-Host "      Args: $args" -ForegroundColor DarkGray
   
   $exitCode = (Start-Process -FilePath "msiexec.exe" -ArgumentList $args -Wait -Passthru).ExitCode
   Write-Host " Exit Code: $exitCode"
   
   if($exitCode -ne 0)
   {
    Write-Error "Installing $MsiFile failed!, Exit Code: $exitCode"
   }
   Write-Host " Installed MSI success.." -ForegroundColor Green
   Write-Host ""
  }
  Invoke-Command -scriptblock $script
 
 #Step 2 : Run MSBuild & Deploy
 
  $script=
  {
   <# Start Step 2.2 Run EnvironmentSettingsExporter, this one generates the xml file
   (Exported_DevSettings.xml, Exported_LocalSettings.xml etc..)
   #>
   $args = "`"" + (Join-Path $ApplicationInstallPath "Deployment\EnvironmentSettings\SettingsFileGenerator.xml") + "`"" + " Deployment\EnvironmentSettings"
   $exePath = ("`"" + (Join-Path $ApplicationInstallPath "\Deployment\Framework\DeployTools\EnvironmentSettingsExporter.exe") + "`"")
   Write-Host " Generating Environment Settings File.."  -ForegroundColor Cyan
   Write-Host " Location: $exePath" -ForegroundColor DarkGray
   Write-Host "  Args: $args" -ForegroundColor DarkGray

   $exitCode = (Start-Process -FilePath $exePath -ArgumentList $args -Wait -PassThru).ExitCode
   Write-Host " Exit Code: $exitCode"
   
   if($exitCode -ne 0)
   {
    Write-Error " Generating Environment Settings File failed!, Exit Code: $exitCode"
   }
   Write-Host " Generated Environment Settings File. " -ForegroundColor Green
   Write-Host ""
   <# End Step 2.2 Run EnvironmentSettingsExporter, this one generates the xml file
   (Exported_DevSettings.xml, Exported_LocalSettings.xml etc..)#>
   <# Start Step 2.3 Set the Environment Variables ENV_SETTINGS and BT_DEPLOY_MGMT_DB #>
   $settingsFile = "Deployment\EnvironmentSettings\Exported_{0}Settings.xml" -f $Environment
   $EnvSettings =Join-Path $ApplicationInstallPath $settingsFile

   Write-Host " Setting Environment Variables"  -ForegroundColor Cyan
   
   Write-Host "      ENV_SETTINGS = $EnvSettings" -ForegroundColor DarkGray;
   Set-Item Env:\ENV_SETTINGS -Value $EnvSettings
   
   Write-Host  " BT_DEPLOY_MGMT_DB = $BTDeployMgmtDB"  -ForegroundColor DarkGray;
   Set-Item Env:\BT_DEPLOY_MGMT_DB -Value $BTDeployMgmtDB
   
   Write-Host " Setted Environment Variables"  -ForegroundColor Green
   Write-Host ""
   <# End Step 2.3 Set the Environment Variables ENV_SETTINGS and BT_DEPLOY_MGMT_DB #>
   
   <# Start Step 2.4 Execute MS Build with parameters #>
   
   #Get .NET Version
   $dotNetVersion = gci 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' | sort pschildname -des | select -fi 1 -exp pschildname
   if($dotNetVersion = "v4.0") { $dotNetVersion = "v4.0.30319" } #Include other info if .NET 4.0
   
   if (Test-Path ( Join-Path $env:windir "Microsoft.NET\Framework\$dotNetVersion\MSBuild.exe" ))
   {
    $BTDFMSBuildPath = Join-Path $env:windir "Microsoft.NET\Framework\$dotNetVersion\MSBuild.exe"
    Write-Host " Using MSBuild $dotNetVersion" -ForegroundColor DarkGray
   }
   else
   {
    Write-Error " MSBuild not found."
   }
   
   #Assign MS Build Params
   $parms="DeployBizTalkMgmtDB=$BTDeployMgmtDB;Configuration=Server;SkipUndeploy=$SkipUndeploy"
   $logger="FileLogger,Microsoft.Build.Engine;logfile=`"" + ( Join-Path $ApplicationInstallPath "DeployResults\DeployResults.txt" ) + "`""
   $btdfFile="`"" +  (Join-Path $ApplicationInstallPath "Deployment\Deployment.btdfproj") + "`""
   $args = "/p:{1} /l:{2} {0}" -f $btdfFile,$parms,$logger
   
   Write-Host " Executing MSBuild from: $BTDFMSBuildPath"  -ForegroundColor Cyan
   Write-Host " ArgList: $args" -ForegroundColor DarkGray
   
   #Check MSBuild Return Code
   $exitCode = (Start-Process -FilePath $BTDFMSBuildPath -ArgumentList $args -Wait -Passthru).ExitCode
   Write-Host " Exit Code: $exitCode"
   Write-Host ""
   if($exitCode -ne 0)
   {
    Write-Error " Error while calling MSBuild, Exit Code: $exitCode"
   }
  
   #Copy Log File
   Write-Host " Copying  Log file."
   $args =  "Deployment\Framework\CopyDeployResults.msbuild /nologo"
   Start-Process -FilePath $BTDFMSBuildPath -ArgumentList $args
   
   <# End Step 2.4 Execute MS Build with parameters #>
  }
 
  Write-Host " Running MS Build and deploying.." -ForegroundColor Cyan
  Invoke-Command -scriptblock $script
  Write-Host " Deployed application" -ForegroundColor Green

}

Download Script (MSWord): Install-BizTalkApplication – Powershell Script 

 

%d bloggers like this: