With Sueetie v4.0 shaping up to be a solid Social Media Platform for the Enterprise, I needed to be sure Sueetie could support corporate sites that support multiple IIS host names. An example would be a site accessed both externally and internally, externally at, say, http://external.coolcompany.com and internally at http://coolcompanynet.
WCF is able to support only a single base address out of the box, and errors to the server Event Log would be generated for any site whose identity does not conform to the base address specified in the Sueetie web.config’s WCF settings. That won’t be an issue with Sueetie v4.0.
To configure Sueetie to support WCF services in a multi-host environment we’re going to make modifications to two files only, SueetieService.svc and the web.config.
Sueetie Premium Edition includes a special "ServiceHostFactory" class that modifies how WCF Service Hosts are created. We’re going to specify that Service Host Factory class in SueetieService.svc, located at /util/services/SueetieService.svc. We’re going to add a single "Factory" element to our @ServiceHost statement. Add it exactly as you see below.
<% @ ServiceHost Language="C#" Debug="true" Service="SueetieService" CodeBehind="~/CodeFiles/SueetieService.cs" Factory="Sueetie.Components.SueetieServiceHostFactory" %>
We’re going to modify the web.config WCF settings to support multiple host endpoints. Replace the corresponding lines in your web.config with the following.
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> <services> <service name="SueetieService" behaviorConfiguration="SueetieServiceAspNetAjaxBehavior"> <host> <baseAddresses> <add baseAddress="http://domain1.com/util/services/SueetieService.svc"/> <add baseAddress="http://domain2.com/util/services/SueetieService.svc"/> </baseAddresses> </host> <endpoint behaviorConfiguration="SueetieServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="SueetieService" /> </service> </services>
"Domain1.com" and "Domain2.com" or any additional hosts will be replaced by your site’s hosts.