all Technical posts

Impersonate WCF Credentials when calling a WCF Service

One of the requirements that I regularly encounter is that I need to call WCF TCP or WCF Web with trusted authentication.
My development laptop or my virtual machines are never member of the customer domain so that makes it almost impossible to develop and test against services of the customer. For Example, Microsoft Dynamics is often used with WCF-TCP which only allows for trusted authentication.

I did some searching on the internet and there doesn’t seem to be a good solution for it. Or at least I was not able to find it. That is why I created a Behavior to do just that. I also added an option “Enabled” to the behavior, if that is set to “False” the behavior will not impersonate.

I did this to make the behavior “Deployment Framework Friendly”. I used the deployment framework and have impersonation working on my local machine. On the servers in the DTAP environment the credentials of the “BizTalk Service Account” were used and Impersonation was set to “False”. By introducing this variable you can use the same binding file for every environment and configure the actual impersonation in the “EnvironmentSettings” spreadsheet which is part of the BTDF.

But this post is about a “problem” and should include a solution as well. So here is the complete working code of this behavior.

 

Subscribe to our RSS feed

Hi there,
how can we help?

Got a project in mind?

Connect with us

Let's talk

Let's talk

Thanks, we'll be in touch soon!

Call us

Thanks, we've sent the link to your inbox

Invalid email address

Submit

Your download should start shortly!

Stay in Touch - Subscribe to Our Newsletter

Keep up to date with industry trends, events and the latest customer stories

Invalid email address

Submit

Great you’re on the list!