Reputation: 2733
I've searched for a couple hours and can't find an exact answer to the following question.
Is there an advantage to hosting web services on a sub-domain as opposed to having virtual directories point to the web services themselves.
Ex.: webserivces.domain.com/login vs. domain.com/webservices/login
IIS relies on application pools, and assuming that the web services are associated to a single application pool, then what is the difference between hosting a segregated website (e.g., sub-domain) versus applying a virtual directory to each website utilizing those same web services.
domain.com/
-- WebServices/ <- Where the web services actually reside
---- login
-- WebSite1/
---- Login.aspx
-- WebSite2/
---- Login.aspx
WebSuite.domain.com
-- WebServices/ <- VIRTUAL DIRECTORY
-- WebSite3/
---- Login.aspx <- Calls "login" web service through virtual directory
Upvotes: 1
Views: 627
Reputation: 3624
Personally i always go for sub domains as its much more flexible/extensible than using vdirs but either way works fine (particularly at small scale). My reasoning for subdomains is:
When you initially roll out your 2 dns names you can point both to the same server at no cost (if anything improved throughput as browser throttle requests per hostname).
At some point in the future you might want to split the front and back ends onto 2 severs. With subdomains this is simple, spin up your new server then make a single DNS change. The two domains could be further upgraded with load balencers allowing multiple web/api servers etc - all pretty seamlessly. Those upgrades with vdirs are trickier and require more work (but still totally do-able).
Application pools enforce process isolation - so (in theory) app pools shouldn't adversely impact each other (performance/security).
The front and back-end have very different workloads and optimal configurations, and if they have no specific requirements to be in the same app pool its best practise to keep the separate.
(subjective) Operating at the website level is easier for scripting/automation/deployment.
So basically, if your talking about a low traffic site with limited growth potential it really doesn't matter. If theres any possibility you will need to scale up, save yourself some pain and go the subdomain route from the start.
Upvotes: 1