Skip Ribbon Commands
Skip to main content

eWorldTree, LLC

Branch out your information network™. Link to eWorldTree ™.

Home
May 07
BizTalk 2010 not tracking in send/receive ports

I ran into a very similar problem as described in the following link:

http://stackoverflow.com/questions/11863980/biztalk-not-tracking-send-receive-ports

At the end, I was able to track message bodies and properties on my send/receive ports after updating the configuration of the corresponding pipeline(s) in BizTalk.System. For message tracking to work, make sure that the Message send and receive events option is checked.

NOTE: Do not check the Track Message Bodies options unless you want to track message bodies in all BizTalk application ports that make use of the corresponding pipeline.

March 16
Simple AppFabric Metrics for WCF Service Operations

The following is a simple T-SQL example that demonstrates how to obtain the number of successful calls to a WCF service operation being monitored by AppFabric:

DECLARE @offset INT;

DECLARE @startDate DATETIME,@endDate DATETIME,@startUtcDate DATETIME,@endUtcDate DATETIME;

 

SET @offset = DATEDIFF(hour, GETDATE(), GETUTCDATE())

SET @startDate = '2013-03-15'

SET @endDate = '2013-03-16'

SET @startUtcDate = DATEADD(hour,@offset,@startDate);

SET @endUtcDate = DATEADD(hour,@offset,@endDate);

 

SELECT SUM(AggregateCount) as 'Successful Calls'

    FROM [AppFabric_Monitoring].[dbo].[ASWcfEvents]

    WHERE OperationName = 'MyOperation'

        AND EventType = 'AggregateOperationCompleted'

        AND (TimeCreated > @startUtcDate and TimeCreated < @endUtcDate)

 

 

To obtain the number of unsuccessful calls, change the SELECT statement as follows:

SELECT COUNT(OperationName) as 'Unsuccessful Calls'

    FROM [AppFabric_Monitoring].[dbo].[ASWcfEvents]

    WHERE OperationName = 'MyOperation'

        AND EventType = 'OperationFaulted'

        AND (TimeCreated > @startUtcDate and TimeCreated < @endUtcDate)

 

Notes:

  1. The desired date range is converted to UTC format.
  2. The 'successful calls' sample assumes that the AppFabric collector is configured with aggregation enabled, which is the default value.
  3. Make sure your service operation defines a fault contract and throws a fault exception for unsuccessful operations.
  4. Refer to this link if the AppFabric Event Collection Service is not collecting metrics for WCF service operations.
October 30
Unable to terminate or cancel a persisted Workflow instance in AppFabric Dashboard

If you get the following error when attempting to manually terminate or cancel a persisted WF instance in the AppFabric Dashboard:

"A remote side security was not fulfilled during authentication. Try to increase the ProtectionLevel and/or ImpersonationLevel"

Make sure to have checked the Enable instance control checkbox in the Workflow Host Management configuration. This configuration option allows manual control commands against persisted WF instances via the AppFabric Dashboard.

July 14
Tracing EntireX’s .NET Wrapper Runtime in Windows

Summary of Steps for EntireX v8.X

  • Set environment variable ERX_TRACELEVEL to capture EntireX RPC Runtime behavior. Optionally, but sometimes mandatory (more on this later), set environment variable ERX_TRACEFILE to indicate the output location of the log.
  • If desired, set environment variable ETB_STUBLOG to capture the contents of Broker Stubs.

A Windows restart is necessary for the tracing configuration to take effect. Once you're done diagnosing your application, delete the environment variables and issue a new Windows restart. Verify that the size of the logs is not increasing.

Software AG's Documentation Resources

Example 1: Diagnosing a .NET Console Application

NOTE: Refer to the Tracing webMethods EntireX documentation for an explanation of the trace levels.

The output of both the EntireX RPC Runtime and the Broker Stubs are written by default to %USERPROFILE%/My Documents/Software AG/EntireX:

Example 2: Diagnosing an ASP.NET Application

In this example, a location for the RPC Runtime log has been configured with the value C:\ProgramData\Software AG\EntireX\ERXTrace.@RANGE[1,999].log. If the ERX_TRACEFILE variable is not configured, the RPC runtime call will fail with error 00010046, which indicates that the tracing for the EntireX RPC Runtime could not be switched on.

NOTE: Refer to the Tracing webMethods EntireX documentation for an explanation of the "@RANGE" variable.

The output of the Broker Stubs in an ASP.NET application is written to C:\ProgramData\Software AG\Entirex by default. Example:

EntireX RPC Runtime Log Snippet

Broker Stub Output Snippet

 

March 14
Operation Name Missing in AppFabric Tracked Events Page

If AppFabric is not displaying operation names in the AppFabric Tracked Events page, follow these steps to force the AppFabric Event Collection Service to store operation contract names in the Data1Str field of the dbo.ASStagingTable.

Use the event viewer to show the analytical and debug logs for the Application Server-Applications view:

Enable the analytical log:

Once these steps are completed, the AppFabric will start collecting WCF operation contract names as "operation names" for the WCF call history. Example:

February 28
No Metric Data is being displayed in AppFabric Dashboard

If Windows Server AppFabric is not displaying metric data in the dashboard:

  1. Make sure that the SQL Agent Service that executes jobs for the Monitoring SQL database is running. Otherwise event data will be stuck in the ASStagingTable. An excellent overview of the processing of monitoring data can be found here.
  2. If additional troubleshooting is needed, refer to this blog post. Another good reference is available here.

SQL Server Agent Snippet:

November 17
WCF SQL Server Adapter (Implementing Polling and Event-Driven Consumers)

It was fun to be a presenter at the Twin Cities Connected Systems User Group Meeting on November 17th, 2011. Here are the links to the presentation (and demo):

Cheers,

--Juan I. Arriaga

August 19
Enqueue and Dequeue with SQL Server Broker

The following is sample T-SQL code to create SQL Server Broker artifacts and the corresponding stored procedures to queue and dequeue messages:

USE [TestDB]

GO

CREATE SCHEMA [EWT]

GO

 

CREATE MESSAGE TYPE [http://eworldtree.com/SampleOrder/V1]

VALIDATION = WELL_FORMED_XML

 

CREATE CONTRACT [http://eworldtree.com/SampleOrderContract/V1]

    ( [http://eworldtree.com/SampleOrder/V1] SENT BY INITIATOR,

    [http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog] SENT BY TARGET )

 

CREATE QUEUE [EWT].[MyInitiatorQueue]

WITH

STATUS = ON,

RETENTION = OFF ,

ACTIVATION (

        STATUS = ON,

        PROCEDURE_NAME = [EWT].[EndConversation] ,

        MAX_QUEUE_READERS = 1,

        EXECUTE AS SELF )

        

CREATE QUEUE [EWT].[MyTargetQueue]

WITH STATUS=ON

 

CREATE SERVICE [MyEnqueueService]

ON QUEUE [EWT].[MyInitiatorQueue]

([http://eworldtree.com/SampleOrderContract/V1])

 

CREATE SERVICE [MyDequeueService]

ON QUEUE [EWT].[MyTargetQueue]

([http://eworldtree.com/SampleOrderContract/V1])

 

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author: eWorldTree

-- Description:    Dequeues a transaction

-- =============================================

CREATE PROCEDURE [EWT].[DequeueTransaction]

    @transaction XML OUTPUT

    ,@success BIT OUTPUT

    ,@queueCount INT OUTPUT

    ,@errorMsg NVARCHAR(MAX) OUTPUT

AS

BEGIN TRY

    SET NOCOUNT ON;

    SET @errorMsg = '';

    DECLARE @cg UNIQUEIDENTIFIER

    DECLARE @ch UNIQUEIDENTIFIER

    DECLARE @messageTypeName NVARCHAR(256)

    DECLARE @messageBody XML;

    BEGIN TRANSACTION;

    RECEIVE TOP(1)

        @cg = conversation_group_id,

        @ch = conversation_handle,

        @messageTypeName = message_type_name,

        @messageBody = CAST(message_body AS XML)

    FROM [EWT].[MyTargetQueue];

    IF (@@ROWCOUNT > 0)

    BEGIN

        PRINT 'Conversation Handle: ' + CAST(@ch AS NVARCHAR(MAX));

        PRINT 'Message Type: ' + CAST(@messagetypename AS NVARCHAR(MAX));

        PRINT 'Message Body: ' + CAST(@messagebody AS NVARCHAR(MAX));

        END CONVERSATION @ch;

        COMMIT TRANSACTION;

        SET @transaction = @messagebody;

        SET @success = 1;

        SET @queueCount = (SELECT COUNT(conversation_handle) from [EWT].[MyTargetQueue]);

    END

    ELSE

    BEGIN

        PRINT 'No requests pending.'

        ROLLBACK TRANSACTION;

        SET @transaction = '';

        SET @success = 1;

        SET @queueCount = (SELECT COUNT(conversation_handle) from [EWT].[MyTargetQueue]);

    END

END TRY

BEGIN CATCH

    PRINT 'Error: ' + CAST(ERROR_NUMBER() AS NVARCHAR(MAX)) + ' ' + CAST(ERROR_MESSAGE() AS NVARCHAR(MAX));

    ROLLBACK TRANSACTION;

    SET @transaction = '';

    SET @success = 0;

    SET @queueCount = (SELECT COUNT(conversation_handle) from [EWT].[MyTargetQueue]);

    SET @errorMsg = CAST(ERROR_NUMBER() AS NVARCHAR(MAX)) + ' ' + CAST(ERROR_MESSAGE() AS NVARCHAR(MAX));

END CATCH

GO

 

-- =============================================

-- Author: eWorldTree

-- Description:    Enqueues a transaction

-- =============================================

CREATE PROCEDURE [EWT].[EnqueueTransaction]

    @transaction NVARCHAR(MAX)

    ,@success BIT OUTPUT

    ,@queueCount INT OUTPUT

    ,@errorMsg NVARCHAR(MAX) OUTPUT

AS

BEGIN TRY

    SET NOCOUNT ON;

    SET @errorMsg = '';

    DECLARE @ch UNIQUEIDENTIFIER

    BEGIN TRANSACTION;

    BEGIN DIALOG CONVERSATION @ch

        FROM SERVICE [MyEnqueueService]

        TO SERVICE 'MyDequeueService'

        ON CONTRACT [http://eworldtree.com/SampleOrder/V1] WITH ENCRYPTION=OFF;

    PRINT 'Sending msg '+ CAST(@transaction AS NVARCHAR(MAX));

    SEND ON CONVERSATION @ch MESSAGE TYPE [http://eworldtree.com/SampleOrder/V1] (@transaction);

    COMMIT TRANSACTION;

    SET @success = 1;

    SET @queueCount = (SELECT COUNT(conversation_handle) from [EWT].[MyTargetQueue]);

    PRINT 'Msg sent on conversation handle ' + CAST(@ch AS NVARCHAR(MAX));

END TRY

BEGIN CATCH

    PRINT 'Error: ' + CAST(ERROR_NUMBER() AS NVARCHAR(MAX)) + ' ' + CAST(ERROR_MESSAGE() AS NVARCHAR(MAX));

    ROLLBACK TRANSACTION;

    SET @success = 0;

    SET @queueCount = (SELECT COUNT(conversation_handle) from [EWT].[MyTargetQueue]);

    SET @errorMsg = CAST(ERROR_NUMBER() AS NVARCHAR(MAX)) + ' ' + CAST(ERROR_MESSAGE() AS NVARCHAR(MAX));

END CATCH

GO

 

-- ==========================================================

-- Author: eWorldTree

-- Description:    Ends the conversation at the Initiator Queue.

-- ==========================================================

CREATE PROCEDURE [EWT].[EndConversation]

AS

BEGIN TRY

    DECLARE @cg UNIQUEIDENTIFIER

    DECLARE @ch UNIQUEIDENTIFIER

    DECLARE @messageTypeName NVARCHAR(256)

    DECLARE @messageBody XML;

    BEGIN TRANSACTION;

    RECEIVE TOP(1)

        @cg = conversation_group_id,

        @ch = conversation_handle,

        @messageTypeName = message_type_name,

        @messageBody = CAST(message_body AS XML)

    FROM MyInitiatorQueue;

    IF (@@ROWCOUNT > 0)

    BEGIN

        PRINT 'Conversation Handle: ' + CAST(@ch AS NVARCHAR(MAX));

        PRINT 'Message Type: ' + CAST(@messagetypename AS NVARCHAR(MAX));

        PRINT 'Message Body: ' + CAST(@messagebody AS NVARCHAR(MAX));

        END CONVERSATION @ch;

        COMMIT TRANSACTION;

    END

    ELSE

    BEGIN

        PRINT 'No queue items pending.'

        ROLLBACK TRANSACTION;

    END

END TRY

BEGIN CATCH

    PRINT 'Error: ' + CAST(ERROR_NUMBER() AS NVARCHAR(MAX)) + ' ' + CAST(ERROR_MESSAGE() AS NVARCHAR(MAX));

    ROLLBACK TRANSACTION;

END CATCH

GO

April 16
PowerShell Script to uninstall GAC Assemblies in BizTalk Application

The following is a sample of a PowerShell (PS) script function that makes use of the ExplorerOM object model to iterate through the assemblies in a BizTalk application to uninstall them from the global assembly cache (GAC) upon confirmation:

$TargetServer = "localhost"

$BizTalkMgmtDb = "BizTalkMgmtDb"

$ConnectionString = "Server=" + $TargetServer + ";Initial Catalog=" + $BizTalkMgmtDb + ";Integrated Security=SSPI;" # ConnectionString for ExplorerOM functionality.

 

function RemoveAssemblies()

{

param

(

[string] $AppName

)

Set-Alias gacutil $CommonDeployFolder\gacutil.exe

[void][Reflection.Assembly]::LoadFile("C:\Program Files\Microsoft BizTalk Server 2009\Developer Tools\Microsoft.BizTalk.ExplorerOM.dll")

$BizTalkExpObj = New-Object "Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer"

$BizTalkExpObj.ConnectionString = $ConnectionString

$BizTalkExpObj.Refresh()

 

[Microsoft.BizTalk.ExplorerOM.Application] $BizTalkApp = $BizTalkExpObj.Applications[$AppName]

foreach($Assembly in $BizTalkApp.Assemblies)

{

$unGac = Read-Host "Uninstall" $Assembly.DisplayName "from GAC (1=Yes)?"

if ($unGac -eq 1) {

gacutil /u $Assembly.DisplayName

}

}

}

Write-Host $(Get-Date) "Loaded BizTalk Helper functions."

 

Assuming a common library of functions, "dot source" the helper library and invoke the RemoveAssemblies function as in the following example:

 

$ApplicationName = "MyBTApp"

$CommonDeployFolder = "c:\temp\BTSdeploy\"

$BizTalkHelper = "c:\temp\BTSdeploy\BTHelper.ps1"

 

Write-Host *** BEGIN ***

 

. $BizTalkHelper # "dot source" the helper library.

 

RemoveAssemblies -AppName:$ApplicationName

 

Write-Host `n *** END ***

 

WARNING: Be careful when unGAC'ing an assembly. Other applications may depend on such assembly. For more information about undeploying BizTalk applications, visit the following links:

 

April 16
PowerShell Script to restart BizTalk Host Instance

The following is a sample of a PoweShell (PS) function that makes use of Windows Management Instrumentation (WMI) to restart a BizTalk host instance:

function ManageHostInstance()

{

param

(

[string] $HostName,

[bool] $StartHostInstance

)

$filter = "HostName = '" + $HostName + "'"

$HostInstance = get-wmiobject MSBTS_HostInstance -namespace 'root\MicrosoftBizTalkServer' -filter $filter

$HostInstanceState = $HostInstance.GetState().State

Write-Host $(Get-Date) "Current state of" $HostName "Host Instance:" $HostInstanceState # 1=Stopped, 2=Start pending, 3=Stop pending, 4=Running, 8=Unknown

if ($StartHostInstance -eq $TRUE)

{

if ($HostInstanceState -eq 1) {

$HostInstance.Start() }

}

else

{

if ($HostInstanceState -eq 4) {

$HostInstance.Stop() }

}

Write-Host $(Get-Date) "New state of" $HostName "Host Instance:" $HostInstance.GetState().State

}

 

Assuming you have a common PS library of functions, "dot source" this helper library and restart the BizTalk host instance as in the following example:

 

$BizTalkHelper = "c:\temp\BTSdeploy\BTHelper.ps1"

 

Write-Host *** BEGIN ***

. $BizTalkHelper # "dot source" the helper library.

Write-Host "===> Restarting BizTalk host instance..."

ManageHostInstance -HostName:"BizTalkServerApplication" -StartHostInstance:$FALSE

Write-Host "'n"

ManageHostInstance -HostName:"BizTalkServerApplication" -StartHostInstance:$TRUE

Write-Host "<=== Restarted BizTalk host instance."

Write-Host `n *** END ***

 

The output should be similar to the following:

 

*** BEGIN ***

4/16/2011 12:07:34 PM Loaded BizTalk Helper functions.

===> Restarting BizTalk host instance...

4/16/2011 12:07:34 PM Current state of BizTalkServerApplication Host Instance: 4

 

__GENUS : 2

__CLASS : __PARAMETERS

__SUPERCLASS :

__DYNASTY : __PARAMETERS

__RELPATH :

__PROPERTY_COUNT : 1

__DERIVATION : {}

__SERVER :

__NAMESPACE :

__PATH :

ReturnValue :

 

4/16/2011 12:07:36 PM New state of BizTalkServerApplication Host Instance: 1

'n

4/16/2011 12:07:36 PM Current state of BizTalkServerApplication Host Instance: 1

__GENUS : 2

__CLASS : __PARAMETERS

__SUPERCLASS :

__DYNASTY : __PARAMETERS

__RELPATH :

__PROPERTY_COUNT : 1

__DERIVATION : {}

__SERVER :

__NAMESPACE :

__PATH :

ReturnValue :

 

4/16/2011 12:07:38 PM New state of BizTalkServerApplication Host Instance: 4

<=== Restarted BizTalk host instance.

 

*** END ***

1 - 10Next