A random collection of epiphanies, thoughts and problem solutions pertaining to .NET and BizTalk.

Wednesday, October 27, 2004

Got tired of running Deployment Wizard?


I found it is very annoying to run the BizTalk deployment wizard to deploy or undeploy the assemblies during development phase. Especially when you have multiple assemblies to deal with. You can actually write a simple batch file to automate the deploy/undeploy process. BizTalk provides a BTSDeploy.exe in the installation directory that can take various arguments to perform these tasks easily. The following code (undeploy.bat) is a very rough sample for the undeployment. The deployment step is just the opposite. In case you don't know how to find out the public key token of your assembly, you could use these commands: sn -T assembly.dll and sn -t keyfile.snk.


@echo off
SETLOCAL

::
:: Set the deploy environmental variables for App
::
SET server=dbserver
SET db=BizTalkMgmtDb
SET btsdir="C:\Program Files\Microsoft BizTalk Server 2004"
SET outdir=..\App\bin\Development
SET log=.\undeployapp.log

::
:: The following section could be repeated if mutiple assemblies
:: to be undeployed...
::
SET name=App
SET version=2.0.0.0
SET pkt=29068414d03ece02
SET culture=neutral

echo Undeploy %name% %version% from GAC and %db% on %server% ...
::
:: Perform undeployment; use BTSDeploy.exe
::
%btsdir%\BTSDeploy
REMOVE SERVER=%server% DATABASE=%db%
NAME=%name% VERSION=%version% CULTURE=%culture%
PUBLICKEYTOKEN=%pkt% UNINSTALL=True LOG=%log%

pause

The node to be inserted is from a different document context


Inside your message assignment shape, if you try to do :


Construct MsgB
{
theXmlDoc.DocumentElement.AppendChild
(
xpath
(
MsgA,
"//*[local-name()='someElement']"
)
);
MsgB = theXmlDoc;
}

You will run into this error:

Event Type: Error
Event Source: XLANG/s
Event Category: None
Event ID: 10034
Date: 10/27/2004
Time: 4:13:29 PM
User: N/A
Computer: B00D059B675E2
Description:
Uncaught exception terminated service A, instance B

The node to be inserted is from a different document context.

Exception type: ArgumentException
Source: System.Xml
Target Site: System.Xml.XmlNode AppendChild(System.Xml.XmlNode)
Help Link:
Additional error information:

SOLUTION: This is because the node to be copied belongs to another Xml document and is not recognized by the destination xml document. In order to make it work, you will need to import it first. If you read MSDN's documentation for the XmlNode.AppendChild() method, you will notice the following description:

...
If the node being inserted was created from another document, you can use XmlDocument.ImportNode to import the node to the current document. The imported node can then be inserted into the current document. ...

Therefore, all you need to do is to add XmlDocument.ImportNode() method in the message assignment expression editor:



Construct MsgB
{
theXmlDoc.DocumentElement.AppendChild
(
theXmlDoc.ImportNode
(
xpath
(
MsgA,
"//*[local-name()='someElement']"
)
)
);
MsgB = theXmlDoc;
}


Cannot retrieve list of objects due to a WMI provider failure. New transaction cannot enlist in the specified transaction coordinator.


Cannot retrieve list of objects due to a WMI provider failure. New transaction cannot enlist in the specified transaction coordinator.


This problem occurs when you run the BizTalk Server across the fire wall. Take a look at the following links:


KB 250367


KB 306843


KB 300083


Ports need to be opened

Sunday, October 24, 2004

Windows Command Line Tricks


  • Command Line Expansion:

    I am sure you like the command line expansion capability of csh, tcsh and bash in unix family of operating systems. You can have the same capability in Windows Command Line if you enable it. :-) You can use "tab" to expand the whole command line argument after you give a few starting characters. To enable this capability, set the following registry key value to 9.

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\PathCompletionChar


  • Open File Explorer From cmd and Set Address to Current Working Directory:

    Developers constantly spend time in command line and sometime it is useful to start up the file explorer from the comand line environment. It will be very cool and save us a little bit time if the file explorer opened will point to the same working directory. You can do this easily with this command:
    C:\Program Files\Microsoft BizTalk Server 2004> explorer %cd%
    This command will open up a file explorer and take you to directory:
    C:\Program Files\Microsoft BizTalk Server 2004

Followers