New release of QuickCounters…

There is a new release of QuickCounters up at http://codeplex.com/quickcounters
Great new useability additions to the viewer application by Dave Comfort, as well
as fewer priviliges required against remote servers.  See here for
the quick tour…

I’ll be talking about using QuickCounters with BizTalk at tonight’s Minnesota
BizTalk User Group meeting.  (Last night, I was presenting on using Scrum
with Team Foundation Server at the Minnesota VSTS User
Group – it’s been a busy week!)

BizTalk – Strange Exception Messages and Corresponding Fixes.

During our BizTalk development we come across some really strange error message, which normally doesn’t reflect the real cause. I always wanted to consolidate everything in one place. After seeing couple of errors that’s being raised in the news groups, I thought this is the right time to materialize it. If you have come across any strange errors and willing to share please let me know via my contact page.

========================================================

Exception: ‘System.Xml.XmlDocument’ does not contain a definition for ‘Status’

========================================================

Cause:

System.Diagnostics.Debug.WriteLine(PO_SOURCE.Status.ToString());

Resolution:

status = PO_SOURCE.Status;
System.Diagnostics.Debug.WriteLine(status.ToString());

where “status” is a variable of type System.String.

Credit: Tim

Remark: When you try to do the conversion directly on the context property, the above exception is raised. You can easily fix it by first assigning the context property to a local variable and then doing the conversion.

Date Logged: 17th May 2007 (BizTalk 2006)

========================================================

ERROR: The BAM deployment failed.
A connection cannot be made. Ensure that the server is running.
No connection could be made because the target machine actively refused it

========================================================

Credit: Saravana Kumar

Remark:

If you receive the following error when you try to deploy BAM activities using bm.exe tool

The error information doesn’t reflect on the actual cause. Make sure, “SQL Server Analysis Services” is started.

Date Logged: 26th April 2007 (BizTalk 2006)

Nandri!

Saravana

Testing WCF service implementations

When writing WCF implementations, or any code for that matter, testing is an important part of the process. This week, I was building tests for implemented WCF services and had difficulty aligning all the external dependencies of the tests (running hosts, configuration settings, behavior component references, etc). As a result, I set up my WCF services to be self-hosted services, run from the context of the test itself. This has several advantages, and some pitfalls. The advantages:


 


%u00b7         Isolation, the test has external dependencies only to the actual service implementation.


%u00b7         No manual setup running hosts to ensure they are available, the test ’just works’.


 


The pitfall might be:


 


%u00b7       Configuration settings could become out-of-sync. Because the host of the service implementation runs within the context of the test and thereby it’s AppDomain, you need to configure the service ABCs within the test configuration file. This could mean over time you’d get configuration settings for the tests no longer in sync with the actual host.


 


However, because the scope of the tests is under your control and so is it’s configuration, the described pitfall might not pose an issue.


 


In order for the test to host it’s own instance of the services to be tested I created a generic container. It’s a simple, but effective, class which can easily host different service types (all tracing and the IDisposable implementation removed for clarity):


 


/// <summary>


/// Defines a generic implementation of a runnable background host.


/// </summary>


/// <typeparam name=”T”>The service to run within the host.</typeparam>


public class RunnableBackgroundHost<T> : IDisposable where T : class, new()


{


internal AutoResetEvent stopEvent = new AutoResetEvent(false);


 


/// <summary>


/// Starts the host on a new thread.


/// </summary>


public void Run()


{


            ThreadPool.QueueUserWorkItem(


new WaitCallback(delegate(object state)


            {


                using (ServiceHost host = new ServiceHost(typeof(T)))


                {


                    host.Open();


 


                    stopEvent.WaitOne();


 


                    host.Close();


                }


}));


}


 


/// <summary>


/// Stops the running host.


/// </summary>


public void Stop()


{


stopEvent.Set();


}


}


 


Using this class, testing services become quite easy. Set up the host before starting the test:


 


[System.Diagnostics.CodeAnalysis.SuppressMessage(


“Microsoft.Performance”,


“CA1812:AvoidUninstantiatedInternalClasses”), TestClass]


class HostInit


{


protected static RunnableBackgroundHost<Service1> service1;


protected static RunnableBackgroundHost<Service2> service2;


 


[AssemblyInitialize]


public static void AssemblyInitalize(TestContext context)


{


service1 = new RunnableBackgroundHost<Service1>();


service2 = new RunnableBackgroundHost<Service2>();


 


service1.Run();


service2.Run();


}


 


[AssemblyCleanup]


public static void AssemblyCleanup()


{


service1.Stop();


service2.Stop();


}


}


 


And set up your test, using a generated proxy (svcutil) and assuming the service is alive:


 


[TestClass]


public class Service1Tests : IDisposable


{


private Service1Client service1Client;


 


[TestInitialize]


public void TestInitialize()


{


service1Client = new Service1Client();


}


 


[TestMethod]


public void TestService1Method1()


{


Service1Request request = new Service1Request();


request.Id = “1”;


 


Service1Response response = service1Client.Method1(request);


 


            Assert.IsNotNull(response, ErrorMessages.NullResponse);


            Assert.AreEqual<int>(


response.Field,


1,


ErrorMessages.NonMatchingId);


}


}


 


ErrorMessages is a simple resource file containing the messages the test would display in case of failure.


 


What the test framework does in this case:


 


%u00b7         Call the static method HostInit.AssemblyInitalize marked with [AssemblyInitialize].


%u00b7         For every class within the test marked with [TestClass]


o    Call any instance method marked with [TestInitialize].


o    Run any method marked with [TestMethod].


o   


%u00b7         Call the static method HostInit.AssemblyCleanup marked with [AssemblyCleanup].


 


Within the test configuration file, configure both the service host and the client:


 


<system.serviceModel>


<client>


<endpoint


address=http://localhost:8889/Services/Service1


binding=basicHttpBinding


contract=IService1 />


</client>


<services>


<service name=Service1>


<endpoint


address=http://localhost:8889/Services/Service1


binding=basicHttpBinding


contract=IService1 />


                  </service>


</services>


</system.serviceModel>


 


That’s the basic setup. You can now easily test different services by defining the tests for it in it’s own class using it’s own generated client proxy and adding the service to the HostInit class. You could test behaviors by adding them to the configuration file and writing a test for them if they can be tested from the outside.


 


Just press SHIFT+ALT+X to run the test in the debugger. No console windows popping up, your test just executes :).

My first Silverlight Video… Composed… Transcoded… Uploaded and Embedded… All in 5 minutes!

I downloaded and installed Roxio Buzz this morning.


Now I was impressed how quickly it allowed me to get a slideshow built and uploaded to the silverlight streaming service.


I opened the ap dragged in 28 photos and 1 wmv file… clicked the share button… chose silverlight streaming added my account and key (you only need to do this once) and then typed in a simple title.


The Transcoding started and 5 minutes from installing the application I had my travel slideshow on the web… Nice!


N.B. It is easy to miss this piece of UI that tells you what is happening after the transcoding step…



Drum roll please…

function CreateSilverlight(){Sys.Silverlight.createHostedObjectEx({source: “streaming:/33/Roxio000001129762f7b6470a2d16000a874c4663b399”,parentElement: Roxio000001129762f7b6470a2d16000a874c4663b399Wrapper});}

var Roxio000001129762f7b6470a2d16000a874c4663b399Wrapper = document.getElementById(“Roxio000001129762f7b6470a2d16000a874c4663b399Wrapper”);
CreateSilverlight();

Orchestration – Handle SOAP Exception and deal with Suspended (resumable) messages

The main reason for this blog post is due to this newsgroup post

Download Sample from here.

Step #1: Catching SOAP Exception:

Whenever you call a Web service it’s a good practice to handle the SOAP exception specifically rather than just leaving the orchestration to throw an un-handled exception which will result in orchestration service instance and all the referenced message instances being suspended. As shown in the following Orchestration diagram, handling a  SOAP exception is straight forward. Place your “Send” shape inside a “Scope” and add an Exception Handler with “Exception Object Type” configured to System.Web.Services.Protocols.SoapException (You need to add reference to “System.Web.Services”). The “Message Assignment” shape  inside the catch block got this simple statement

SOAP_EXCEPTION_MESSAGE = soapException.Detail.InnerXml;

Where SOAP_EXCEPTION_MESSAGE is an Orchestration message of type System.String and soapException is the “Exception object name” we assigned for the exception handler. So, with the following setup, whenever there is an exception a message similar to the one shown below will be generated and send across the wire with configured adapter (FILE, SMTP etc).

<string><ns0:NACK Type=”NACK” xmlns:ns0=”http://schema.microsoft.com/BizTalk/2003/NACKMessage.xsd”><NAckID>{2DA185D7-40E7-4279-9F6E-ADCEB6EF599B}</NAckID><ErrorCode>0xc0c01f07</ErrorCode><ErrorCategory>0</ErrorCategory><ErrorDescription>SoapException: System.Web.Services.Protocols.SoapException: Purposely raised this exception for testing at CustomerProcessing.Get500InternalSoapException(String yourName) </ErrorDescription></ns0:NACK></string>

Step #2: suspended(resumable) messages:

Even though you handled the SOAP exception using an exception handler in STEP #1, it’s only going to complete the orchestration gracefully but it’s going to leave the original request message you posted to the web services in a suspended(resumable) state. Bear in mind the SOAP exception will be raised inside the orchestration only after the send port has exhausted all the retries.  During this period the messaging instance and orchestration service instance will be in the dehydrated state as shown below.

After all the retries, the SOAP exception will be raised inside the orchestration and corresponding SOAP request message will be suspended with resumable state as shown below. This will help the administrator to either resume or terminate the message later.

 

But at some scenario we don’t wont to leave the suspended (resumable) messages in the messagebox, instead move them to a different location (either to file system location or a remote server via HTTP etc, etc). Before BizTalk 2006 the only way to archive this behavior is by writing some WMI scripts, which is OK but doesn’t really fit with the message flow infrastructure. But with BizTalk 2006 we can take advantage of “Failed Message routing” capability and make this task seamless.

All you have to do is, on your SOAP send port check the check box “Enable routing for failed messages” (as shown in the following figure) and also you can set optionally the “Retry Count” value to “0” if you want to raise the SOAP exception straight away.

Then configure a “Send Port”  (or an orchestration, if you want to do more business logic with the suspended messages) with following filter condition

ErrorReport.ErrorType == “FailedMessage”

ErrorReport.OutboundTransportLocation ==  http://localhost:47653/SOAPExceptionHandler.WebService/CustomerProcessing.asmx

The above filter condition will make sure you are dealing only with SOAP exception raised due to messages posted to that particular web service (CustomerProcessing.asmx). There are quite a bit of promoted properties that comes along with “ErrorReport” you can take advantage of to cater your situation as listed below.

  • Description
  • ErrorType
  • FailureCategory
  • FailureCode
  • InboundTransportLocation
  • MessageType
  • OutboundTransportLocation
  • ReceivePortName
  • RoutingFailureReportID
  • SendPortName

Related Reading:

http://blogs.conchango.com/matthall/archive/2005/07/28/1894.aspx

http://objectsharp.com/cs/blogs/matt/archive/2006/11/01/4110.aspx

Nandri!

Saravana 

Great guy – Andrew Connell

During the conference I had the pleasure and oppty to spend some time with Andrew and
his family. The conference was tooooo short – should have been 4 days.

It’s not often you come across great inspiring people, with a great attitude to ‘lets
see if we can make this better’, and a fantastic personality to match!! (nothing worse
than wall flowers).

We kicked some tyres around Sharepoint and hatched a few ideas of “what would be really
cool if…”.(stay tuned)

Very level headed guy with a great perspective on what’s important and what’s not….I
suspect that may have alot to do with his wife Merideth 🙂 (just
a hunch!)

It’s a pleasure.

Mick.

Tahiti….is now called ‘SharedView’. What a great piece of Software

Tahiti….is now called ‘SharedView’. What a great piece of Software

A magic piece of software that deserves a great rap!!! 🙂

There I was….on a client site ‘inbetween’ meetings (as best you get) and I got a
call from another client having a biztalk issue and needed some guidance. (sound familiar….family
members wanting remote phone support….)

So I was chatting to my beloved/dear client trying to sort out the issue. If
only I had a view of their screen….I thought smile_eyeroll

I then ran some thoughts through my head…..Netmeeting….I could try and
get that going, but what about firewalls…the whole I’ll call you, no you call me
thing – it works, doesnt work….time consuming to set up etc. (you get the picture)
– I’m thinking this is gonna be at least a 30min phone call.

Then I remembered (as a MVP) I get a few offers each month of ‘use our product’ type
deals….and I remembered this one from Microsoft called ‘Tahiti
– sharing/collaboration tool. (not to be confused with the Tahitian – “Save the cheerleader….save
the World!”)

Now get this – from digging up the past email, clicking on a link, 3MB download, installing
and setting up a session, inviting the person at the end of my support call (via email,
or I could use IM). And then they doing a corresponding setup etc. 15minutes!!!!
15 minutes only!!!

And within that time I was seeing their screen, control of their screen AND
we had invited another techie to the session to help resolve their area of the problem.

So 3 people, all behind respective firewalls – collaboratively sharing etc.

SENSATIONAL!!!!! It really is a top top top (3 tops – must be good 🙂 application.

Well you can grab the application (which is now called SharedView)
from Microsoft
Connect – Shared View

 

 

And now the finally……..in 15 minutes…the sharing window!

 

(AND it’s the sort of app that if you’ve got running….people are GOING to stop by
your screen and think it’s the next SilverLight application!!)

Resources for Learning WPF &amp; Silverlight

There are some great resources out there for getting started with Silverlight and WPF since I get this question so often I thought I would post the details here.


1. Silverlight Resources (Well as I say why re-invent the wheel).


Tim’s list of Silverlight Screencasts & Expression Media Encoder.


Joe Stegman’s Video Search Sample [code and session]


2. Expression (WPF) Resources


Best training resources for Expression are here.


Also worth looking at the Expression Launch Page.


If you are coming from a Flash/ Flex Background


http://lynda.com, ContentPresenter and the WPFblog offers 3rd party web based training created by Flash legend Lee Brimelow.


Resources for .NET Developers


WPF Wiki – Sample Aps


FamilyShow – sample app built in WPF w/ video and code.


Watch Rob Relyea’s Windows Presentation Foundation for Developers presentation (references). This will provide an understanding of the overall vision for WPF and, more importantly, a sense of the possibilities of the platform by seeing some of the very best WPF demos.


http://windowsclient.net/


.NET Framework 3.0 Virtual Labs

Learning Plan to Begin Developing .NET Framework 3.0 Applications

A few agencies I know that are doing WPF & Silverlight projects

IdentityMine, thirteen23Metaliq, Frog Design, Avenue A | Razorfish, Lightmaker, Cynergy

Trust me the hardest part with all of this stuff is choosing to start 😉