Thursday, 1 May 2014

Add User permissions for EventSource Registry -Powershell

I had a situation to create 10 event sources at registry and add 4 different level of permission for each event sources. This would be an easy and manual task when you want to add it for only one server.

What If you need to do similar job for 10 different servers?  I presume deployment Engineer would take minimum of 1 hour time to do this task. don't you think?


Here is the another way to reduce the time by writing Powershell script.


-------------------------------------------------------------------------------------------------------------------------------

$userInput = Read-Host "Enter the Environment (DEV / SYS ) :"

function AddEventPermissions([string]$Principle, [string]$LogName)
{
    $LogPath = "HKLM:\SYSTEM\CurrentControlSet\services\eventlog\Application\" + $LogName;
    if(Test-Path $LogPath)
    {
        $acl = Get-Acl $LogPath
        $access = [System.Security.AccessControl.RegistryRights]"FullControl"
        $inheritance = [System.Security.AccessControl.InheritanceFlags]"ObjectInherit,ContainerInherit"
        $propagation = [System.Security.AccessControl.PropagationFlags]"None"
        $type = [System.Security.AccessControl.AccessControlType]"Allow"

        $rule = New-Object System.Security.AccessControl.RegistryAccessRule($Principle,$access,$inheritance,$propagation,$type)
        $acl.AddAccessRule($rule)
        
        Set-Acl $LogPath $acl
    }
    else
      {
        Write-Error "Cannot acesss log $LogName"
      }
}

$AppGroup ='';
$isloatedGroup='';

if  ($userInput  -eq "DEV")
{
    $AppGroup ='Domain\DEVUserAccount';
}
elseif ($userInput -eq "SYS")
{
    $AppGroup ='Domain\SYSUserAccount';
}
else
{
    Write-Error "Please select required Environment to Add event log permissions.";
}

if ( $userInput -eq "")
{
    try
      {
            AddEventPermissions $AppGroup 'MYEventLogSource'
       }
      catch [System.Management.Automation.RuntimeException]
        {
            write-Error "Error while adding permissions: $_.Exception.ToString()"
        }
}
---------------------------------------------------------------------------------------------


Drop a comment if this article helped you to solve your problem. you can reach me @ raj.webjunky@yahoo.com

Wednesday, 23 October 2013

Microsoft.ServiceModel.Channels.Common.ConnectionException: Connection request timed out


Recently I have added two more Oracle Polling ReceiveLocations to poll the data form same Oracle Server. Its was going smooth but I have seen the Production event logs fill with below warning message. 
This is quite simple to fix it . You need to add TransactionTimeout period and transaction isolation level.

Transaction isolation level = Serializable

TransactionTimeout = same as your receive timeout period.


The adapter "WCF-OracleDB" raised an error message. Details "Microsoft.ServiceModel.Channels.Common.ConnectionException: Connection request timed out ---> Oracle.DataAccess.Client.OracleException: Connection request timed out

at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)

at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
at Oracle.DataAccess.Client.OracleConnection.Open()
at Microsoft.Adapters.OracleDB.OracleDBConnection.OpenConnection(OracleCommonExecutionHelper executionHelper)
--- End of inner exception stack trace ---
at Microsoft.ServiceModel.Channels.Common.Channels.AdapterInputChannel.EndTryReceive(IAsyncResult result, Message& message)
at System.ServiceModel.Dispatcher.InputChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext)".

The below link would help you for how to add http://msdn.microsoft.com/en-US/library/dd787944(v=BTS.10).aspx



Drop a comment if this article helped you to solve your problem. you can reach me @ raj.webjunky@yahoo.com



xmlReader.Read() skipping nodes xmlReader.ReadOuterXml()


XMLReader.Read() is strange behaviour when I try to parse XML using the XmlReader object. It usually skips the record and move the pointer to next level of element while loop through the elements. The code which I used to find each child records.

This is the sample xml file.











The code which I used to find each child records as detailed below.

When you call ReadOuterXml() method this would consume the complete xml  and point the cursor to just before the next element.

In my example the cursor will pint to element of Order ID=2 record. Hence it never satisfies the condition to fetch Record 2.




Here is the alternate way to find the child records.


You can reach me @ raj.webjunky@Yahoo.com




Friday, 21 June 2013

BizTalk 2013 DynamicPort assign custom Handlers


Hope you might have experience with how ESB Toolkit 2.1 handles the Receive/Send Handlers.  Basically the 2.1 uses the default handler to process the message even though you sophisticatedly defined your own handlers. Microsoft addressed this issue and improved  in 2.2 release and now with 2.2 you have a rich GUI to assign your custom handlers.

This would help you to configure your applications to balance the load and segregate the process also it would  help you to avoid many other issues like memory leakage and Host throttling etc.
Here I have created a sample Testproject  Hosts ( Receive , Send) and assign them into FILE adapter.

I have created a sample Test Itinerary Project too where I used Static Resolver with FILE adapter to transform he orders to Orders Summary message.  

Itinerary Design



Below screenshot illustrate how many SEND handles been assign for FILE adapter and what was the default adapter out of 3 Send handlers.




Back in ESB Toolkit 2.1 if you had similar configuration  then it leverages with default handler to process the message .  The new ESB Toolkit 2.2 you can define your custom handler.

Hope this would help you for your development.

You can reach me @ raj.webjunky@Yahoo.com

Friday, 5 April 2013

BizTalk BAM Undeploy definitions


Many times I use to forget the BAM Definition file where I saved and struggled to un-deploy the BAM definition without BAM definition file. Hope many of you faced this situation.
Here is easy way of creating definition file even you missed the file.


All you have to do is Create the BAM definition struction as mentioned below.


Run the below query to get Activity and view xml structures which was  already deployed in your server.

Use [BAMPrimaryImport]

SELECT  A.[ActivityName],
A.ViewName,
B.[DefinitionXml] 'ActivityXml', 
C.[DefinitionXml] 'ViewXml' 
FROM
[dbo].[bam_Metadata_ActivityViews] A 
Inner Join [dbo].[bam_Metadata_Activities] B
On A.[ActivityName]= B.[ActivityName]
Inner Join [dbo].[bam_Metadata_Views] C 
On A.ViewName = C.ViewName

Copy the ActivityXMl and ViewXML to the newly created BAM definition xml file.

Now you need execute the undeploy command.

"C:\Program Files (x86)\Microsoft BizTalk Server 2010\Tracking\bm.exe" remove-all -DefinitionFile:"NewDefinitionFile.xml"

Monday, 8 October 2012

Publish Schema as WCF Service with Transformed message



When you publish Schema as WCF Service and expecting to get a transformed message back to the caller you often sees a Routing Failure message rather than properly structured response.
This article helps you to fix routing failure error and get response (transformed) message without changing source and destination schemas.

I have written an article at MS site. Please click here

You can reach me @ raj.webjunky@Yahoo.com

Friday, 10 August 2012

BizTalk ESB Toolkit BAM Track SOAP Fault

Problem statement : 
An event of SOAP fault we do not have any control to correlate the mesage(SoapFault message) with requst message hence the BAM Track created an enty without correlate with request message.

Quite busy with many other issues, soon will post the article.
cheers...