System.Diagnostics.Process, RedirectStandardOutput process hanging

In one of our internal web app’s developement, we were executing an console applications with certain arguments synchronously and were trying to display the results in the front-end.

When we activate the process I can see the process getting kicked-off in the task manager and it never exits, after a time period (IIS timeout setting), the web app times out.

At the end we figured out, the reason is due to an dead lock condition between the parent process (w3wp) and the child process(console app).

Synchronous read operations introduce a dependency between the caller reading from the StandardOutput stream and the child process writing to that stream. These dependencies can result in deadlock conditions. When the caller reads from the redirected stream of a child process, it is dependent on the child. The caller waits on the read operation until the child writes to the stream or closes the stream. When the child process writes enough data to fill its redirected stream, it is dependent on the parent. The child process waits on the next write operation until the parent reads from the full stream or closes the stream. The deadlock condition results when the caller and child process wait on each other to complete an operation, and neither can proceed.

Solution is really simple, look at the code snippet below.

// Start the child process.
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = “Write500Lines.exe”;
p.Start();
// Do not wait for the child process to exit before
// reading to the end of its redirected stream.
// p.WaitForExit();
// Read the output stream first and then wait.
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();

BTW, most of explanation is from MSDN, but it took me a while to figure out.

MS BRE: Using ’OR’ in MS BRE Rules

This article explores and sheds some light on a feature of the Microsoft Business Rules Engine which I consider to be important in understanding the semantics of rules.   This is the use of ‘or’ to create a group of conditions within a rule.   We will see that ‘or’ has a very specific meaning in Microsoft’s rule engine and that this meaning may not be quite what you might have expected.   We will also see how the MS BRE simplifies the model, making rule creation more intuitive than it might otherwise have been, and we will compare and contrast the use of ‘or’ in the Microsoft Business Rule Engine with the use of ‘or’ in a similar Java-based rules engine called Jess.


 


http://geekswithblogs.net/cyoung/articles/79500.aspx

5 more BizTalk samples are live in the MSDN Web site.

5 more BizTalk samples are live in the MSDN Web site. I wrote three of them as follows:


1) SSO as Configuration Store
This sample provides an implementation of a sample class and a walkthrough that demonstrates how to use the SSO administrative utility and the SSOApplicationConfig command-line tool.    


2) Atomic Transactions with COM+ Serviced Components in Orchestrations
This sample demonstrates how atomic transactions work in orchestrations.    


3) Using the SQL Adapter with Atomic Transactions in Orchestrations
This sample shows how to use the SQL adapter with atomic transactions to keep databases consistent.     

 In my samples, I used to BizUnit 2006 to make it easy to repro the steps and change the samples. If you have any feedbacks about the samples, please leave a message.

5 more BizTalk samples are live in the MSDN Web site.

5 more BizTalk samples are live in the MSDN Web site. I wrote three of them as follows:


1) SSO as Configuration Store
This sample provides an implementation of a sample class and a walkthrough that demonstrates how to use the SSO administrative utility and the SSOApplicationConfig command-line tool.    


2) Atomic Transactions with COM+ Serviced Components in Orchestrations
This sample demonstrates how atomic transactions work in orchestrations.    


3) Using the SQL Adapter with Atomic Transactions in Orchestrations
This sample shows how to use the SQL adapter with atomic transactions to keep databases consistent.     

 In my samples, I used to BizUnit 2006 to make it easy to repro the steps and change the samples. If you have any feedbacks about the samples, please leave a message.

UK SDC Build and Deployment Framework and Biztalk

UK SDC Build and Deployment Framework and Biztalk

Just stumbled across this post about the UK SDC Build and Deployment Framework for MSBuild. Actually I did download the zip from GDN a while ago and didnt get to investigate in detail and Howard has listed the tasks nicely on his blog. The thing Im most interested to find is that it has a series of tasks that deal with Biztalk 2004.I’ve just posted a message on the workspace to find out if it can work with VS2003 and MSBee. Since Biztalk 2004 is a .NET 1.1 product, i think it should but im not sure if the tasks themselves have been written in .NET 2.0. although a backport should be possible if the source code is available. 

.NET 2.0 Assembly Version Redirection

Have you ever wanted to upgrade a version of an assembly and not have to recomplie code?  One way to accomplish this is using assembly binding in your configuration file.  First make sure that both the old assembly and the new one use the same strong key file and are both in the GAC.  Then add the following to your application configuration file:



<configuration>


  <runtime>


    <assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″ >


      <dependentAssembly>


        <assemblyIdentity


                name=”DevelopMentor.Mandelbrot”


                publicKeyToken=”be418bc72a93105f” />


        <bindingRedirect oldVersion=”1.0.0.0″


                             newVersion=”2.0.0.0″ />


        </dependentAssembly>


    </assemblyBinding>


  </runtime>


</configuration>


Next time the application configuration is refreshed and run, the new version will be loaded instead of the old one. 

BizTalk 2004: Questions for interview without answers

BizTalk 2004, Questions for interview without answers


Standards


BPEL4WS: Comparing of BizTalk 2004 and BPEL4WS


Which points is the BTS Orchestration different from BPEL4WS in?


Which objects in the BTS have different names from BPEL4WS?


Does the link object have a state?


What does it mean the “JoinCondition”?


What is the BizTalk analogue of the BPEL “Message Event” object?


What is the BizTalk analogue of the BPEL “Alarm Event” object?


WSDL 2.0


Which are names of the root tag and the upper level tags in WSDL 2.0?


Which children are nodes the “operation” and “endpoint”?


Can we use the third party schemas in the WSDL document? How?


Theory, Principles


Subscription/Publishing mode


What are two main types of subscriptions? What is the difference?


What is the Message Agent? It is the service for polishing/subscribing of the messages. (?)


What is the Endpoint Manager?


What is the Message Type?


When a send port creates a subscription?


Do we use enlist/unenlist operations for subscription or for publisher services?


Which three artifacts we can enlist/unenlist?


Is the Binding implementation of the Subscription/Publishing model? If “No”, what the model is it implementing?


Why some BizTalk artifacts can be Enlisted and Started and others can only be Enabled?

What kind of errors depends of those actions (Enlisted, Started, Enabled)?

Orchestrations


Can I receive one message with the same type from different Receive port to one Receive shape?


Can I receive the same message with the same type to several Receive shapes?


Can I send the same message to the different Send ports?


Can I send the different messages with the same type to several Send ports?


Where do Filters for SP and RP “locate“?


Can several Transform shapes be used inside one Construct shape? If can do the Source message “map” both of them to the Target message or only one of them? Which one?


Can Transform shape and Assign shape are both used inside one Construct shape? If can do the Source message “map” both of them to the Target message or only one of them? Which one?


Which properties of the operations on the Port shape we use and what purpose for?


How we can transform data between types: String, XmlDocument, message – inside Orchestration?


Does Shape “Throw Exception” create an event or/and a Suspended Instance Service, if surrounding scope doesn’t handle this exception?


Maps


Can we see the name of method or class or assembly of the External Script functoids in the Property window?


Can we pass the value of the string/Boolean/int typed node to the Script functoid if the method of this functoid has input parameters of another type? If can where the transformations doing?


Which is right for the input Boolean parameter of the method of Script functoid: “TRUE”, “True” or “true”?


Which value we get as the output Boolean parameter of the method of Script functoid: “TRUE”, “True” or “true”?


Can we use 1/0 as the input Boolean parameter of the method of Script functoid?


Can we get the value from the Logical functoid to the Destination XML document?


Which value we can use on place of the Boolean input parameter of the functoid: “True”, “TRUE” or “true”?


When we “Test map“ with “Generate instance“ option how much records would be generate for record with “Min Occurs“ equal 0 and “Max Occurs“ equal “Unbounded“?


When we “Test map“ with “Generate instance“ option how much records would be generate for record with “Min Occurs“ equal 1 and “Max Occurs“ equal “Unbounded“?


How we can get the name of node from Source Xml document to mapping?


How we can get the name of node from Target Xml document to mapping?


How we can eliminate mapping of the Empty source node? (An empty source node should NOT create the empty target node)


How we can enforce mapping of the Empty target node? (An absent source node should create the empty target node)


Can we choose between creating two kind of the Empty target nodes in mapping, and  (with two tags and one tag)?


Can we choose between creating the Empty target node and eliminating the Empty target node in mapping?


Is there any difference in processing “the Empty node” and “no node” cases in mapping?


We produce a target node with “Value Mappong” functoid. This node has properties “Max/Min Occurs” = default (1) and “Default Value” = “0”. Which value have we got if first parameter of the “Value Mappong” functoid is equal “false”?
(“0” / Empty string / 0 (integer) / null (node is not created))


Rule sets, Policies


You use in MyPolicy some facts from MyXmlDoc schema. When you are choosing MyPolicy in the Call Rules shape you can not see and choose the parameters of MyPolicy. Why? (You have only one message variable with MyXmlDoc type and it chosen automaticaly / You did not change manualy property the “Document Type“ for facts of the MyXmlDoc schema / You use the wrong version of MyPolicy in Orchestration / You use the wrong version of vocabulary for MyPolicy)


You use MySchema in the MySolution.MyProgect assembly and use in policy MyFact that is NodeA under RootNode of the MySchema. What the value should be property the “Document Type“ for this fact? (MySchema /  MySolution.MyProgect / MySolution.MyProgect.MySchema / NodeA / RootNode.NodeA / MySchema.RootNode.NodeA / MySolution.MyProgect.MySchema.RootNode.NodeA)


You deployed 1.1 version of MyPolicy, then chose MyPolicy in CallRules shape of MyOrch, then you deployed the assembly with MyOrch, and then you deployed 1.2 version of MyPolicy. Which version of the MyPolicy is in use? (1.2, 1.1, you should change the version of MyPolicy in CallRules shape)


You use a Policy in an Orchestration. Action in your Rule has changed a value of node in Xml message. How you can get this new value in Orchestration?
(I get it in the Expression shape only if it is promoted. / I get it in the Expression shape anyway by xpath(). / I have to use a variable to pass this value to the Orchestration.)


You use in your Vocabulary and Policy class PolicyHelper. You have changed the name of this class to the PolicyOneHelper. What will be going on in Composer?
(Because the assembly name and namespace are not changed, Policy and Vocabulary will automatically change name. / You have to manually change the name in Composer. / You have to manually choose class with new name in your definitions/rules for Vocabulary/Policy. / You could not open those Vocabulary and Policy and will get an error.)


You use a Policy in an Orchestration. You start to use new class in your Policy. You have deployed new version of this Policy.
Will your Orchestration work without any error? (Yes/No)
Will your Policy work in the Orchestration well? (Yes/No)
Do you need to manually change an Orchestration? (Yes/No)
Have you got an error if you try to rebuild Orchestration without this change? (Yes/No)


How can we track executing of the Rules?
(HAT/Queries/Policies; / load Add-On to HAT then HAT/Queries/Policies; / HAT/choose one of the Service Instance lists ->Right click on one Service Instance/choose Message Flow/choose link “…to view the Policy…”)


If we open HAT, a window “Policy Execution Details” and go to the one of the windows with the rule execution information (like “Fact Activity”) how we can go back and forward between those information windows?
(File / Navigate back/forward; Alt- -> <-; No way)


How we can see the working version of the Policy?
(HAT/go to the window “Policy Execution Details”; HAT/Configuration/Policies; in Orchestration click “CallRules” shape and view list of the current policies; in Registry, key “<BREroot>/Policies in use”)


Ports, Adapters


Where are the maps assigned to the Receive Locations and Send Ports?


If we delete a Send port from the Send Port Group do we delete the Send Port itself?


If we delete a Receive Location from the Receive Port do we delete the Receive Location itself?


Do Send port and Receive Port have the same object structure? Tell about how the properties assigned to the objects.


Do the Service Window for Send and Receive ports have the Properties “Start Date” and “Stop Date”?


Are parameters of the Service Window of Send ports and Receive ports saved in the binding file?


Which advantages/disadvantages are creating ports from the Orchestration by options “Specify now” or “Specify later”?
Can we make file in the FILE Receive Location undeleted? What was going on in this case?


Why Receive Port can get a collection of Maps on it but Send Port Group can’t get Maps (Send Port can)?


Why Receive Port can get a collection of Maps on it but not the Receive Location?


Can we create on the Receive Port a collection of Maps with different Target Schemas?


Why Receive Port and Receive Location can not get a Filter on it but Send Port can get a Filter?


Are the Send Port and Send Shape of the Orchestration (both Subscribers / both Publishers / first is the Subscriber and second is the Publisher / first is the Publisher and second is the Subscriber / none of this)

Does the Send Port ( 1).send message / 2).receive message / 3).publish message / 4).subscribe to the message / 1 + 2 + 4 / 1 + 2 + 3 / none of this)

Does the Receive Location ( 1).send message / 2).receive message / 3).publish message / 4).subscribe to the message / 1 + 2 + 4 / 1 + 2 + 3 / none of this)

SQL adapter and ports


What the difference between one-way and two-way SQL Send ports?


Does the one-way SQL Send port have the Response part?


Can we manually edit the “URI” parameter of SQL Send port and or Receive Location?


Can we use the same URI for several SQL Receive Locations? Can we use the same URI for several SQL Send ports?


Are the SQL Adapter Handler properties the default values for all Ports, or something else?


Which advantages/disadvantages has working with SQL data base through SQL Send and Receive ports vs. working from Orchestration through .NET classes?


What the purpose of generating Multi-part messages by “Add Adapter“ Wizard?


We have generated artifacts by “Add Adapter“ Wizard for SQL Port. What we should do to move them to the different Orchestration? What we should do to move them to the different Orchestration in different Project?


How we can add adapter to the BizTalk? Is it possible by using Add Adapter“ Wizard?


Security


How we can protect data from tracking using schema parameters?


Is the isSensetive attribute worked for promoted properties?


Who own the private part of the key certificate to encrypt message? (Sender/Receiver/SSO service)
Who own the private part of the key certificate to sign message? (Sender/Receiver/SSO service)
Is the Other People certificate store used on (Per Local Computer/Per Local User/Per Domain User) basis?
Which certificate store is used for store the public part of the key certificates? (Personal certificates/Trusted publishers/Untrusted certificates/Other people)
Which certificate store is used for store the private part of the key certificates? (Personal certificates/Trusted publishers/Untrusted certificates/Other people)
Which account do we have to log into to import the decryption certificates to the personal certificate store? (Local user account/Host service account/Administration account/SSO Administration account)
If we have several personal certificates for sign the outbound messages which one will be used? (Specified in the BizTalk Administration Console/Specified in the Certificate service Management Console/Specified in the Configure your server Wizard/Specified in the Local Security Policy Console)
There are steps to configure BizTalk for party resolution. Which one is wrong?
A. To install certificate to the certificate store.
B. To receive certificate from partner.
C. To send certificate to partner.
D. To create a party to represent a partner.
E. To create a pipeline for party resolution.
F. To configure the receive location.
(A/B/C/D/E/F)


Tracking, HAT


What can be the cause of Suspended messages?


How we can see the body of the Suspended message?


How we can see the context of the Suspended message?


You deploy a new version of MyPolisy and want to get the tracking data from it. What you should do? (Choose the new version of MyPilicy in Configuration/Policies window of HAT? Nothing if you also configured HAT to get tracking information from previous version of MyPolicy.)


How to see in HAT the tracking data of your polisy? (Choose from the “Queries” menu the “Most receive Policy“ command / Choose from the “Queries” menu the “Most receive Fired actions“ command / In “Message Flow” window for the Service Instance wich calling your policy you should see the text “Follow this link to view the Policy execution details for this Orchestration Instance“ and click this text)



HAT: Menu Operations: Is here data from (MessageBox data base / Tracking data base / both of them / BizTalkMsgBoxDb.Tracking* tables)?

HAT: Menu Queries: Is here data from (MessageBox data base / Tracking data base / both of them / BizTalkMsgBoxDb.Tracking* tables)?

HAT: Menu Operations: Column “Service Class”: Its value can be “Orchestration” and “Messaging”. Is the “Messaging” the (Adapter Instance service / Pipeline Instance service / Port service / Port Instance service / undefined)

HAT: If the message is Suspended we can frequently see that there are more then one Messages Suspended and related to first Suspended, like a chain of them. Could you describe the situation?
Reliability

Can the message be deleted inside the BizTalk data base?


How can we proceed with the Suspended (Resumable) message?


How can we proceed with the Suspended (Not resumable) message?


How can we repeat the Suspended (Not resumable) message?


Does a message, processed but not routed and got to the Suspended state, is going to delete from the Receive location?


How we can get the Suspended message?


Tuning up


How we can change the timeout for Dehydration of the orchestration?