Friday, August 31, 2012

Activation context generation failed for ...


One of my colleagues was getting the error.

Activation context generation failed for "…". Dependent Assembly Microsoft.VC80.CRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195" could not be found.

We thought installing Visual C++ 2005 Redistributable package on machine should resolve this problem so we installed the following packages on that machine:

But the problem still persisted after installing the above packages. Then we tried to generate the traces using the sxstrace.exe and found that reference was not getting resolved:
INFO: Parsing Manifest File “…”.
   INFO: Manifest Definition Identity is (null).
   INFO: Reference: Microsoft.VC80.CRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195"
INFO: Resolving reference Microsoft.VC80.CRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195".
   INFO: Resolving reference for ProcessorArchitecture amd64.
      INFO: Resolving reference for culture Neutral.
         INFO: Applying Binding Policy.
            INFO: Find publisher policy at C:\Windows\WinSxS\manifests\amd64_policy.8.0.microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4927_none_09bd9a47facfb1f8.manifest
            INFO: No binding policy redirect found.
         INFO: Begin assembly probing.
            INFO: Did not find the assembly in WinSxS.
            INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_64\Microsoft.VC80.CRT\8.0.50727.6195__1fc8b3b9a1e18e3b\Microsoft.VC80.CRT.DLL.
            INFO: Attempt to probe manifest at C:\PDFHotell\Microsoft.VC80.CRT.DLL.
            INFO: Attempt to probe manifest at C:\PDFHotell\Microsoft.VC80.CRT.MANIFEST.
            INFO: Attempt to probe manifest at C:\PDFHotell\Microsoft.VC80.CRT\Microsoft.VC80.CRT.DLL.
            INFO: Attempt to probe manifest at C:\PDFHotell\Microsoft.VC80.CRT\Microsoft.VC80.CRT.MANIFEST.
            INFO: Did not find manifest for culture Neutral.
            INFO: End assembly probing.
   ERROR: Cannot resolve reference Microsoft.VC80.CRT,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195".
ERROR: Activation Context generation failed.
End Activation Context Generation.
This issue gets resolved after the installation of KB2538242 which get installed as part of windows update.
Hope this would be helpful to others!!!
Cheers
Rohit Sharma

Friday, June 1, 2012

Book Review: BizTalk Server 2010 Cookbook by Steef-Jan Wiggers


I like the format of the book and Steef-Jan Wiggers has done a wonderful job of covering broad topics relevant to both the development of BizTalk solution and administration of BizTalk environment in 50+ easy to follow recipes. Enough details has been provided about the topic in each recipe but the good thing about this book is that each recipe also contain There’s more section having valuable resources to dive deeper into the topic discussed. Here is a brief overview of what has been covered in this book:

·         The book starts with the most important topic of setting up the BizTalk environment.  The newbie will like the recipe on how to use the BizTalk Benchmark Wizard to validate the Installation.

·         Second chapter the recipes covered some of the popular design patterns like splitter, aggregator, retry pattern etc.

·         Third chapter contain some useful recipes demonstrating how to instrument the BizTalk solution.

·         In fourth chapter the focus is on securing message exchange and contains some useful demonstration on how to use certificate in BizTalk for signing and encrypting/decrypting the messages.

·         Fifth chapter discuss recipes related to the WCF services and BizTalk

·         Sixth chapter starts with a recipe on installation of AppFabric Connect and then have some useful demonstration on how to connect BizTalk with cloud.

·         Seven chapter is specifically for BizTalk administration and contain some useful recipes on configuring the monitoring tools for BizTalk e.g. SCOM, BizTalk 360.

·         Eighth chapter contain recipes on how to use the Business Rule engine.

·         Last chapter focus on the unit testing of BizTalk Artifacts using the Visual Studio and Frameworks such as BizUnit, BizMock, and the BizTalk Map Test Framework

I found this book useful, this book is available on Packt and Amazon.

Monday, April 16, 2012

Mapping xs:any element to xs:base64Binary element


Source schema is containing <xs:any> element as shown below:


Destination schema is containing element with <xs:base64Binary> as data type as shown below:


To map the string value of <xs:any> element from source to Details element of type  <xs:base64Binary>  in destination. Drag a scripting functoid to map as shown below:


Use the following Inline C# code to convert string into Base64string:

public string GetBase64String(string stringData)
{
   byte[] encodedBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(stringData);
   return System.Convert.ToBase64String(encodedBytes);
}

Drag another scripting functoid and set script type to Inline XSLT as shown below:

 
Use following Inline XSLT code:

<Details xmlns:p="http://MappingBase64Encoded.SourceSchema">
  <xsl:value-of select="userCSharp:GetBase64String(string(/p:Record/Details/*))" />      
</Details>
Note: Here Details element refer to the element in the destination schema and this XPath is to extract the value of child element of Details as there is only one element if there are more then position of child element need to be specified.
Connect the second scripting functoid (having Inline XSLT) to Details element in destination schema as show below:
 
 

Testing the map

Source Instance used:
<ns0:Record xmlns:ns0="http://MappingBase64Encoded.SourceSchema">
  <Source>SourceElement</Source>
  <Details>
    <Data01>This is demo content from source.</Data01>
  </Details>
</ns0:Record>
Map output:
<ns0:Record xmlns:ns0="http://MappingBase64Encoded.DstSchema">
  <Source>SourceElement</Source>
  <Details>VGhpcyBpcyBkZW1vIGNvbnRlbnQgZnJvbSBzb3VyY2Uu</Details>
</ns0:Record>

Cheers
Rohit Sharma

Friday, March 23, 2012

Coping documents between libraries preserving the metadata


I faced a requirements in SharePoint 2007 where the documents need to be copied from one document library to another  document library in a different site (in different farm too) and the metadata of documents was also required to be preserved. I was able to do it using the Copy Web Service the GetItem Method generate a byte array representation of document and it also copied all the metadata in an array of FieldInformation object which can then be passes to CopyIntoItems method to upload the document in the destination document library.

I hope this would help other people finding the simple method of copying documents with metadata.

Cheers,
Rohit Sharma

Monday, February 20, 2012

How to initialize correlation set multiple times?

There was a question in Microsoft BizTalk Server General Forum where the requirement was to promote values on the messages extracted from a batch of messages using orchestration.

How it could be implemented?

To promote the properties in orchestration one need to initialize the correlation set as demonstrated by Sarvana Kumar in his blog. But you can initialize the correlation set only once so here is the way to initialize correlation set multiple times.

I am just extending the code shared by Stephen W. Thomas for Envelope and XPath Debatching in an Orchestration Lab

Download the code from above link and follow these steps:
Step 1. Run the Visual Studio Conversion Wizard to convert the solution.
Step 2. Remove PortDebatching project from solution you don’t need it for this excercise.

 Step 3. Open the XPathSample.odx and create a correlation type and correlation set as shown below:
 

Step 4. Create a variable with name CompanyName and type string and initialize it as shown below:
CompanyName=xpath(SingleInput,"string(/*[local-name()='Data' and namespace-uri()='']/*[local-name()='Company' and namespace-uri()=''])");

Step 5. Drop a message assignment shape in the ConstrustMapped shape and use the following expression:
SingleMapped(BTS.DestinationParty)=CompanyName;

Step 6. Select the send shape SendSingleMessage and initialize the correlation set Correlation_Party


If you will try to build this BizTalk Project now you will get the compile time error: “'Correlation_Party': a correlation may be initialized only once


How to get rid of error 'Correlation_Party': a correlation may be initialized only once”?

- Add a scope shape to the loop and set the Transaction Type for this scope to Automic/Long Running/None.

Note: The only requirement is to have scope shape with the correlation set defined on this scope level. You can set the transaction type to None or atomic or long running  for the scope depending on your requirement.

- Cut the correlation set Correlation_Party  from orchestration level and paste it to the level of this new scope.

- Move the send shape to this new scope.


Note: Check once again that the send port is initializing the correlation set 'Correletaion_Party'.

Build and deploy the solution and you will see Destination Party get promoted with the value of company name for each message generated in the loop.


Cheers,
Rohit Sharma

Monday, January 2, 2012

BizTalk Server MVP 2012


First of all thanks to God, I can't expect any better start for this year. On this new year I got a great news of being Microsoft’s Most Valuable professional (MVP). I thank my peers, community members, fellow MVPs and Microsoft which honored me and recognized my contributions in BizTalk communities.

I'll continue to serve the BizTalk community more effectively with the best of my knowledge and experience.

Thanks
Rohit Sharma