WCF Arbitrary Endpoint and IIS

Link. November 12, 2006. Comments [0]. Posted in: WCF | WinFX

I mentioned a few days ago I had succeeded finally in hooking an arbitrary endpoint into a WCF service host in order to publish custom metadata information associated with a service. Since then, I've been working on cleaning up the code and ensuring the code actually works correctly. A few extra things I've discovered in the process:

I had mentioned I was setting two private properties in the HttpTransportBindingElement class: Method and InheritBaseAddressSettings. I'm not doing that anymore, as it doesn't seem to be really required. Both of my current test services work without it, and I'm still a little unclear as to what these two properties actually accomplish.

I also discovered that the original code I had worked well if the service was self hosted, but didn't work when hosting it in IIS. After spending a few days looking at this I found out that the problem was I wasn't adding a properly configured VirtualPathExtension instance when building my IChannelListener implementation. Fortunately, it was easy to fix by simply copying the existing one in the Extensions collection of the ServiceHost, if one was present.

I'm now able to publish my metadata through an HTTP GET operation on services using my custom behavior by simply setting the EnableHttpGet property on the corresponding attribute or through the configuration file. It's pretty cool, though it requires far more code than I wished for.

The best part about all of this is that it's given me a chance to learn a lot about how certain parts of WCF work, particularly regarding how services are hosted and how metadata generated and published for a service.



Comments are closed.

Syndicate

About

Tomas Restrepo is a software developer located in Colombia, South America. His interests include .NET, Connected Systems, PowerShell and lately dynamic programming languages. More...

tomasrestrepo @ twitter My Flickr photostream My saved links on delicious My Technorati Profile

email: tomas@winterdom.com
msn: tomasr@passport.com

View my profile on LinkedIn

MVP logo

Ads


Categories

Statistics

Total Posts: 1050
This Year: 1
This Month: 1
This Week: 0
Comments: 827

Archive

Other

Copyright © 2002-2008, Tomas Restrepo.

Powered by: newtelligence dasBlog 2.2.8279.16125

Sign In