Tuesday, September 27, 2011

WCF : WCF Test Client “The contract ‘IMetadataExchange’ in client configuration does not match the name in service contract”


Playing around with WCF web services in VS 2010 and .NET Framework 4.

When I run the WCF Test Client across the web service I get the above error. The service still works but there’s an error symbol (a ! in a red circle on the LHS).

Mr. Google to the rescue and you need to change the framework config file here:


Comment out the “endpoint” section i.e.

  <!-- <endpoint address="" binding="netTcpRelayBinding" contract="IMetadataExchange" name="sb" /> -->

Problem solved.

Even though it still works, I hate these niggly errors in case I’ve screwed up Smile


Thursday, September 22, 2011

ADFS : Google top 5 hits

I was looking at my blog stats and noticed that my article on "Re-installing ADFS v2.0" was among my top 5 articles.

So I Googled ""Re-installing ADFS v2.0" and found that the top 5 search entries in Google all point to my blog!

Note that the last one is actually from an aggregate site that points to the same blog entry.

Looking at the stats for this article. I noticed that the biggest source of queries was from the Geneva forum, the next was from stackoverflow and Mr. Google only came in third.

The message is clear - if you want to bump up your search results, write good, solid, factually correct articles and link to them. :-)


Tuesday, September 20, 2011

ASP : Displaying server variables

Sometimes you need to know who you are logged in as.

In the claims world, it’s easy because you have the IPrincipal and IIdentity objects but if these are not available, you need to go back to first principles.

Enter stage left the server variables. These are accessed from the Request object. A simple way to enumerate then all is via the html segment below which you just whack into an asp page.

        <h1>ASP Request Variables Page</h1>

            The current user you are logged in as is: 
                <!-- <%=Request.ServerVariables("AUTH_USER" & "<br />") %> -->
                <%= response.write("AUTH_USER" & "    " &  Request.ServerVariables("AUTH_USER") & "<br /><br />") %>
                for each x in Request.ServerVariables
                    response.write(x & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" &  Request.ServerVariables(x) & "<br /><br />")



Monday, September 12, 2011

ADFS : Selecting claim that's not in the default drop down

When you want to edit the claims rules for a CP or RP in ADFS v2.0, you sometimes need to select an LDAP attribute that's not in the default drop down list.

I've always done this via a custom claim, But then I read this post: Active Directory attribute store: Require custom claim rule to access other attributes?.

The drop down actually allows free-form (not that that is obvious). In case the link disappears, this is how:

"Edit Claims Rules / Add Rule / Send LDAP Attributes as Claims".
Don't select the drop-down, just click in the white space of the grid.
If the box turns dark blue, click again.
Away you go - you can now enter any attribute you like.

This also works for the "Outgoing Claims Type" box.


Stackoverflow : Another milestone

Just clocked up rep. of 6000 over on Stackoverflow !!!

My stackoverflow flair:

profile for nzpcmad at Stack Overflow, Q&A for professional and enthusiast programmers

or overall Stack Exchange flair

profile for nzpcmad on Stack Exchange, a network of free, community-driven Q&A sites


Thursday, September 08, 2011

Windows : The “hidden” tools


There’s an amazing amount of tools “hidden” on your PC that you probably aren’t even aware off Smile.

A lot of them are stored in the

C:\Program Files\Microsoft SDKs\Windows

directory. These mainly derive from the Windows SDK for Windows 7 and .NET Framework 4.

Browse through StartTools.htm located at:

C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin

There’s an amazing collection of tools there.

The actual binaries are located here:

C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin

To quote:

“The Windows SDK tools are designed to make it easier for you to create, deploy, and manage applications and components that target Windows and the Internet. The Windows SDK includes tools for both the .NET 3.5 SP1 and 4 Frameworks - a managed programming model - and tools for Win32® - the native (unmanaged) programming model for Windows. Many of the Windows SDK tools are listed on this page and categorized by target audience: managed, native and "common" (tools that could be used by either managed or native developers).”


Friday, September 02, 2011

PowerShell : Using an IDE


PowerShell is command line which means that you lose out on all the benefits that an IDE brings.

There is an in-built PowerShell IDE:

Just type “ise” from the command line

but it’s pretty basic.

Then I came across PowerGui.

It has two parts viz. an administrative console that allows you to run a collection of PowerShell scripts and a script editor that allows you to enter and run scripts. It has intellisense and a set of built in snippets. It has a debug function where you can step through the script and examine all the variables.

Very neat – and BTW it’s free.