Viewing entries tagged
WCF

2 Comments

Adding custom http header to all WCF requests

I needed to add a customer http header to the outgoing request of a web service call (for authentication purposes). With old web services it was easy to do this, but with WCF it’s a bit tricker. The good thing is that WCF is *very* extensible.

To do this, we need to create a custom WCF behavior and message inspector.

The solution file is available in the resources section of the post.

2 Comments

Comment

401.1 Unauthorized - IIS & WCF using custom host headers and host entry

I ran into a bit of a issue today at a client with Windows Authentication and WCF services (it seems like a very common problem) where I was using a host header in IIS to test a web application I was working on. To do this, I added an entry to the hosts file in %windir%\system32\drivers\etc to map the custom host name (e.g. testapp.com) to 127.0.0.1

Accessing the web application worked fine, but trying to access the WCF services hosted under IIS (also using Windows Authentication) kept prompting the login dialog and then eventually failing with the dreaded 401.1 - Unauthorized

Adrian Foyn pointed me to a registry hack to enable loopbacks by setting the registry key:

Comment