Michael,
That's right. IT IS NOT NECESSARY TO SET HOST HEADERS. Just use the Service definition as put above.
I accessed my hostname as follows in my initialiase of the MVC controller:
protected override void Initialize(System.Web.Routing.RequestContext requestContext) {
base.Initialize(requestContext);
#region Get Current Domain Name
_dnsName = Request.Url.DnsSafeHost;
_dnsName = _dnsName.Replace("www.", "");
Trace.Write("m_dnsName: " + _dnsName);
#endregion
if (dc.Domains.Any(d => d.Name == _dnsName)) {
// do stuff for particular domain
}
else {
Response.Clear();
Response.StatusCode = 404;
Response.Write("No domain found: " + _dnsName);
Response.End();
}
}
Maybe a small disclaimer. I'm working on sdk 1.6 and I haven't updated it to the latest June SDK yet. But i guess that there won't be any changes for that. :-)
Of course using a web role has the disadvantage that you can not use FTP or GIT deployment. If you are running a big SAAS app, that's not a concern in my opinion. You WANT to deploy to a staging environment. And be sure that everything
is running before moving to staging. FTP and GIT just gives to much freedom to do quick (and stupid) fixes.
If our app is deployed to staging, I update the local HOSTS file so that the real domain names are tested against the the staging environment. If everything runs well, I do the VIP swap.
Dampee (blog |
twitter)