WCF and Multiple Host Headers

后端 未结 5 2065
甜味超标
甜味超标 2021-02-06 01:51

My employers website has multiple hostnames that all hit the same server and we just show different skins for branding purposes.

Unfortunately WCF doesn\'t seem to work

5条回答
  •  半阙折子戏
    2021-02-06 02:42

    I don't think that the host base addresses solution posted above will work for IIS-hosted websites (the OP did mention that this was for his employer's website).

    See this blog post

    Also, the other answer further up by thaBadDawg won't work where multiple host headers are specified - you'll just get the errors that the OP mentions ("This collection already contains an address with scheme http".)

    I don't think any of the solutions mentioned so far will work, because it doesn't look like WCF allows a single service to be accessible for a single site with multiple host headers from all of the sites. The only workaround I could find for .Net 3.5 (and under) is to create a different contract for each of the host headers, and use the custom ServiceHostFactory to use the correct host header based on which contract is specified. This isn't at all practical. Apparently .Net 4.0 will resolve this issue.

提交回复
热议问题