WCF 服务、应用程序域和网站
我有许多 WCF 服务(SVC 文件),并且我想将它们托管在 IIS 中。 我想知道:
- 在自己的网站上创建每个网站是否更好?
- 或者让它们一起生活在同一个网站上?
有什么区别?
我读到每个服务都有自己的应用程序域? 是否有任何文章描述 WCF 服务和应用程序域之间的关系?
I have many WCF services (SVC files), and I want to host them in IIS.
I was wondering:
- Is it better to create each one on its own web site?
- Or have them all together live on the same web site?
What is the difference?
I read that each service will have its own Application Domain?
Is there any articles that describe the relation between a WCF service and an Application Domain?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
应用程序域用于隔离应用程序,使应用程序互不影响。因此,为每项服务建立一个单独的网站可提供更高的容错,并允许您更新只改变服务,不影响其他服务。然而部署需要更多的工作。此外,可能会消耗更多的资源,并且初始化将花费更长的时间(因为将创建更多的应用程序域),但如果这不是时间或性能关键的应用程序,那么您可能不会太关心这些。
我认为,如果您的服务之间有很好的分离,您的服务具有(主观上)合理的复杂性,并且由此产生的开销对您来说可以忽略不计,那么最好选择单独的网站,否则就不要。 (是的,总而言之,这取决于情况。)
注意:您可能还想看看这篇文章:
将多个 WCF 服务作为一项服务托管
An application domain is used to isolate applications so that they do not affect each other. Having a separate website for each service therefore offers higher fault-tolerance, and enables you to update only the changing service without affecting the others. However deployment will require a little more work. Also probably more resources will be consumed and initialization will take a little longer (since more application domains will be created), but if it's not a time or performance-critical application those may not be of much concern to you.
I think if there's a good separation between your services, your services have a (subjectively) reasonable complexity and the resulting overhead is negligible for you, it would be better to go for separate websites, otherwise not. (Yeah, in summary, it depends.)
Note: You might also want to take a look at this article:
Hosting multiple WCF services as one single service