Shawn Cicoria - CedarLogic

Perspectives and Observations on Technology

Recent Posts

Sponsors

Tags

General





Community

Email Notifications

Blogs I Read

Archives

Other

Use OpenDNS

June 2010 - Posts

Visual Studio 2010 Architecture Tooling Guidance is published…

Something that I had the privilege to review has been released.

Willy-Peter Schaub goes into great detail about the release, along with links and summaries of all the other great VS ALM Rangers content.

http://blogs.msdn.com/b/willy-peter_schaub/archive/2010/06/26/visual-studio-alm-rangers-architecture-guidance-gets-thumbs-up.aspx?wa=wsignin1.0

http://vsarchitectureguide.codeplex.com/ 

  • Visual Studio 2010 Architecture Tooling Guidance
    • Practical guidance for Visual Studio 2010 Ultimate, focused on modelling tools. These release includes common usage scenarios, hands on labs and lessons learnt from the community discussions. The scenarios include understanding and reverse engineering an existing solution or starting a new solution from scratch. These are both common challenges that any dev lead or architect faces. The intent is not to give you an in-depth tour of the product features, but to present you with examples that show how these tools can support you in real world scenarios, and to provide you with practical guidance and checklists. This guidance is focused on practical ways of effectively using Visual Studio 2010 Ultimate and other tools to create a new or revised design as part of application lifecycle management.
      The Rangers involved with this project are: Alan Wills (MSFT), Bijan Javidi (MSFT), Christof Sprenger (MSFT), Clemens Reijnen (MVP), Clementino de Mendonca (MVP), Edward Bakker (MVP), Francisco Xavier Fagas Albarracín (MVP), Marcel de Vries (MVP), Michael Lehman (MSFT), Randy Miller (MSFT), Tiago Pascoal (MVP), Willy-Peter Schaub (MSFT), Suhail Dutta (MSFT), David Trowbridge (MSFT), Hassan Fadili (MVP), Mathias Olausson (MVP), Rob Steel (MSFT) and Shawn Cicoria (MSFT).
Posted: 06-27-2010 9:49 AM by cicorias | with no comments
Filed under: ,
Can’t see the AppFabric Directory on x64 systems…

This is one I have to jot down.

If you’re using tools like Reflector, or just want to open up any of the files in the c:\windows\system32\AppFabric directory, you’ll run into some issues – like, the tool that you’re using complaining that “can’t find c:\windows\system32\appfabric…”  errors.

On x64 systems, you need to replace the path with:

C:\Windows\SysNative\AppFabric

This is the FileSystem redirector virtual path as described here: http://msdn.microsoft.com/en-us/library/aa384187%28VS.85%29.aspx

The “Jersey Doesn't Stink” website – does it really need a site?

I have to admit, been in Jersey all my life – and yes, it does stink – but probably no more than any other state.  Grass isn’t always greener – and yes, we do have grass in NJ.

Jersey Doesn't Stink

Posted: 06-21-2010 5:45 PM by cicorias | with no comments
Filed under:
Hyper-V Update List for Windows Server 2008 R2

Anytime you’re running the Hyper-V role, is a good place to check for any updates that may be affecting either performance or basic troubleshooting.

Hyper-V Update List for Windows Server 2008 R2
Spaces in type attribute for Behavior Extension Configuration Issues

If you’ve deployed your WCF Behavior Extension, and you get a Configuration Error, it might just be you’re lacking a space between your “Type” name and the “Assembly” name.

You'll get the following error message:

Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions

image

So, if you’ve entered as below without

<system.serviceModel>
  <extensions>
    <behaviorExtensions>
      <add name="appFabricE2E"
           type="Fabrikam.Services.AppFabricE2EBehaviorElement,Fabrikam.Services, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
    </behaviorExtensions>
  </extensions> 

The following will work – notice the additional space between the Type name and the Assembly name:

<system.serviceModel>
  <extensions>
    <behaviorExtensions>
      <add name="appFabricE2E"
           type="Fabrikam.Services.AppFabricE2EBehaviorElement, Fabrikam.Services, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
    </behaviorExtensions>
  </extensions> 
Using a WCF Message Inspector to extend AppFabric Monitoring

I read through Ron Jacobs post on Monitoring WCF Data Services with AppFabric

http://blogs.msdn.com/b/endpoint/archive/2010/06/09/tracking-wcf-data-services-with-windows-server-appfabric.aspx

What is immediately striking are 2 things – it’s so easy to get monitoring data into a viewer (AppFabric Dashboard) w/ very little work.  And the 2nd thing is, why can’t this be a WCF message inspector on the dispatch side.

So, I took the base class WCFUserEventProvider that’s located in the WCF/WF samples [1] in the following path, \WF_WCF_Samples\WCF\Basic\Management\AnalyticTraceExtensibility\CS\WCFAnalyticTracingExtensibility\  and then created a few classes that project the injection as a IEndPointBehavior

There are just 3 classes to drive injection of the inspector at runtime via config:

  1. IDispatchMessageInspector implementation
  2. BehaviorExtensionElement implementation
  3. IEndpointBehavior implementation

The full source code is below with a link to the solution file here: [Solution File]

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Channels;
using System.ServiceModel;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
using Microsoft.Samples.WCFAnalyticTracingExtensibility;

namespace Fabrikam.Services
{
    public class AppFabricE2EInspector : IDispatchMessageInspector
    {
        static WCFUserEventProvider evntProvider = null;
        static AppFabricE2EInspector()
        {
            evntProvider = new WCFUserEventProvider();
        }

        public object AfterReceiveRequest(
            ref Message request,
            IClientChannel channel,
            InstanceContext instanceContext)
        {

            OperationContext ctx = OperationContext.Current;
            var opName = ctx.IncomingMessageHeaders.Action;

            evntProvider.WriteInformationEvent("start", string.Format("operation: {0} at address {1}", opName, ctx.EndpointDispatcher.EndpointAddress));
            return null;
        }

        public void BeforeSendReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
        {
            OperationContext ctx = OperationContext.Current;
            var opName = ctx.IncomingMessageHeaders.Action;

            evntProvider.WriteInformationEvent("end", string.Format("operation: {0} at address {1}", opName, ctx.EndpointDispatcher.EndpointAddress));
            
        }
    }

    public class AppFabricE2EBehaviorElement : BehaviorExtensionElement
    {

        #region BehaviorExtensionElement
        /// <summary>
        /// Gets the type of behavior.
        /// </summary>
        /// <value></value>
        /// <returns>The type that implements the end point behavior<see cref="T:System.Type"/>.</returns>
        public override Type BehaviorType
        {
            get { return typeof(AppFabricE2EEndpointBehavior); }
        }

        /// <summary>
        /// Creates a behavior extension based on the current configuration settings.
        /// </summary>
        /// <returns>The behavior extension.</returns>
        protected override object CreateBehavior()
        {
            return new AppFabricE2EEndpointBehavior();
        }

        #endregion BehaviorExtensionElement

    }

    public class AppFabricE2EEndpointBehavior : IEndpointBehavior //, IServiceBehavior
    {

        #region IEndpointBehavior
        public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters) {}


        public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
        {
            throw new NotImplementedException();
        }

        public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
        {
            endpointDispatcher.DispatchRuntime.MessageInspectors.Add(new AppFabricE2EInspector());

        }

        public void Validate(ServiceEndpoint endpoint)
        {
            ;
        }
        #endregion IEndpointBehavior



    }
}

 

 

[1] http://www.microsoft.com/downloads/details.aspx?FamilyID=35ec8682-d5fd-4bc3-a51a-d8ad115a8792&displaylang=en

AppFabric – where are all the monitoring events?

When you’ve just gone through a setup of AppFabric and you’ve got some WF/WCF things happening, if you start looking at the Dashboard and you see nothing, it might be as simple as restarting SQL Agent.

I generally don’t reboot my system for several days and after installing AppFabric the SQL Agent jobs didn’t start firing right away.  Yes, even running a boot to VHD, you can still put the machine to sleep (just logoff and click on Sleep)…

So, after spending time looking through the SQL monitoring DB that AppFabric was configured to use, I saw a bunch of records in the [AppFabric_Monitoring].[dbo].[ASStagingTable] table.  This table is the stopping point before the SQL Agent job (or Service Broker in SQL Express) pushes the items to their final resting place.

This post goes through a few things to check on AppFabric monitoring

http://social.technet.microsoft.com/wiki/contents/articles/appfabric-items-to-check-when-configuring-appfabric-monitoring.aspx

Of course, during development you might want to clean up regularly

For that there’s the PowerShell command

Clear-AsMonitoringSqlDatabase -Database AppFabric_Monitoring

App_offline.htm and SharePoint and wholly contained images…

The question came up today if we could use an “app_offline.htm” file along with HTML in that file that would reference images.

First, I wasn’t 100% sure if the app_offline.htm would work, but it sure did.  Since it’s just the Asp.net hosting process that detects the file, it circumvents loading any HttpApplications (SharePoint) beyond just serving up the HTML content.

The second question was about having something more than text, specifically <img> tags.  So, since the HttpHandlers are taking all requests for all resources through the Asp.net pipeline, as soon as the app_offline.htm file is there, nothing else will get served from within that web application.    Sure, we could host the file (images) outside the web app, but what fun would that be?

So, I found this link on using an image in app_offline.htm

http://pbodev.wordpress.com/2009/12/20/app_offline-htm-with-an-image-yes-we-can/

Turns out, the src tag (in fact many tags) can take a stream of data represented by a mime type and base64 encoding inline – such as:

<img style="height:515px;width:700px;border-width:0px;"  src="data:image/jpeg;base64,/9j/4AAQSkZJRgA

 

One of the problems we had was the image was too large; so, sliced up the image, but ended up with spaces between each of the slices.  Low and behold, it works with CSS as well.

 

    <style type="text/css">
        .Slice_1_jpg
        {
            position: absolute;
            left:0px;
            top:0px;
            width:1011px; 
            height:148px;
            background: url("data:image/jpeg;base64,/9j/4AAQSkZ

 

And the body is as follows:

  <body>
    <div class="Slice_1_jpg"> </div>

 

For this, I wrote a little Asp.Net site that, using a file upload control, will generate the necessary contents of what needs to go in the “data” value for the stream.  A link to the code is here:

http://cicoria.com/downloads/CreateBase64OfImage.zip

Posted: 06-08-2010 5:26 PM by cicorias | with no comments
Filed under: , ,
BizTalk 2009 Orchestration Fails to Find References on External Assemblies

If you’re developing BizTalk 2009 solutions (Orchestrations) and you’ve split your schemas out into alternative assemblies (projects) – sometimes you’ll get odd not found issues with some (if not all) of the types in those referenced assemblies.  You can try everything – recompile, de-gac, re-gac, – doesn’t matter.

Well there’s a hotfix for this:

http://support.microsoft.com/kb/977428/en-us

FIX: You experience various problems when you develop a BizTalk project that references another BizTalk project in Visual Studio on a computer that is running BizTalk Server 2009

Posted: 06-06-2010 7:10 PM by cicorias | with no comments
Filed under: ,