Aller au contenu | Aller au menu | Aller à la recherche

dimanche 17 février 2019

WCF: Support of wildcard on IIS10 and more

IIS 10 brings support for wildcard domains. However WCF does not support it!
We had a WCF service hosted on IIS (in an Azure CloudService to be more specific) and this website had hostname like "lille.monsite.com ; paris.monsite.com ; lyon.monsite.com …".

Here is the original configuration (was working as expected)

Having a wildcard SSL certificate *.monsite.com, we adapted the configuration to allow the website to respond to *.monsite.com and removed old hostnames. Doing this, the WCF service fails with an HTTP 500 error !

To make it simple : our service cannot load anymore, more precisely it cannot load its' binding configuration.

After some research, we found that WCF does not support host header of wildcard type : https://blogs.msdn.microsoft.com/dsnotes/2017/07/07/wcf-support-for-wild-card-host-header-at-iis-10-and-above/

To fix the problem : we added a fake header "localhost" at top of the header list. The trick here is to allow the service to load using this localhost header. Still, it will nicely respond to queries like "mycity.monsite.com"! Warning, this “non wildcard header” has to be first in the list to make the WCF service to load properly!

Here is the configuration :
and the result :


mardi 19 novembre 2013

Cleanup & Re-opening

That’s it, I finished cleaning up this blog which was not updated for a long time!

You will find here soon some post talking about C#, Visual Studio, and a little of “blabla” of course! Some post will be translation of some other blogs for which I didn't found french version, I will try to post others in french and in english too.

From tips to full projects, also with code samples, I will listen to you if have any remarks/suggestions/ideas…

For now, I let comments in “moderation mode” to reduce spam.

See Ya!