在 IIS 7.5 中托管 WCF 与 Windows 服务的性能考虑
我有一个简单而直接的问题:在比较 IIS 7.5 中的 WCF 服务与 Windows 服务的托管时,是否有任何我不知道的性能优势(或任何其他类型的优势)?
我对这个主题并不一无所知,并且实际上已经在两个托管环境中托管了多个 WCF 服务。然而,我正要启动一项使用量较大的新服务,并想“重新访问”该主题。现在我倾向于 Windows 服务。
我读过如下帖子: IIS WCF 服务托管与 Windows 服务 它提供了一些很好的信息,但有点过时了(是的,甚至只有 1.5 岁;仍然使用代号“Dublin Technologies”)。
对我来说,Windows 服务并没有什么问题,因为我对设置、部署和配置(包括将 SSL 证书应用到托管 WCF 服务的端口)非常满意,因此与 IIS 相比,这对我来说并不是什么大问题。
我一直认为 IIS 中的应用程序回收对于托管 WCF 服务来说是一个缺点,可能会导致小的通信中断。我知道通过 .asmx IIS 托管服务(转换为 WCF),我收到了随机的“401 未经授权”(我的意思是真正随机,就像每 5-10,000 次调用之类的事情),并且我将其标记为 IIS 及其功能的特性在不回收应用程序池的情况下保持 100% 的通信(可能会导致问题?->这个问题在这里不有问题,只是供参考)。
所以我想知道IIS。
我想从目前的角度(许多 MSDN 比较图表也已过时,总是与 IIS 6 进行比较)来了解在 Windows 服务中与 IIS 7.5 中在 Windows Server 2008 R2 上托管 WCF 服务的情况。谢谢!!
I have a simple and direct question: is there any performance benefits (or any other type of benefit) I am unaware of when comparing hosting of a WCF service in IIS 7.5 vs. a Windows Service?
I am not in the dark on this topic and have actually hosted several WCF services in both hosting environments. However I was about to start a new service that has some heavier use and wanted to 're-visit' the topic. Right now I am leaning towards a Windows Service.
I have read posts like the following: IIS WCF service hosting vs Windows Service which gives some good information, but is a bit out of date (yes even only at 1.5 years old; still using codename 'Dublin Technologies').
There is no ding against Windows Services for me because I am quite comfortable with setup, deployment, and configuration (including applying an SSL cert to a port hosting the WCF service), so this is not a big deal to me vs. IIS.
I always thought application recycling in IIS would be a downside to hosting a WCF service, allowing potential for small possible breaks in communication. I know with a .asmx IIS hosted service (converting to WCF) that I have received random '401 Unauthorized' (I mean really random like every 5-10,000 calls kind of thing) and I marked that up to idiosyncrasies with IIS and its ability to keep communication up 100% of the time without the app pool being recycled (possibly causing issue? -> this issue is not in question here and just for reference).
So I wonder about IIS.
I would like a present-day perspective (a lot of the MSDN comparison charts are out of date too, always comparing to IIS 6) on hosting a WCF service on Windows Server 2008 R2 in a Windows Service vs. IIS 7.5. Thanks!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
随着 AppFabric for IIS 的发布,在 IIS 7.5 上托管 WCF 服务变得更容易、更可靠了。 AppFabric 允许您将服务配置为在应用程序池启动时启动,并防止池像普通 Web 应用程序一样回收。它还提供了允许 WCF 服务记录有关其运行状况的信息并监视服务的方法。
对于我最近的 WCF 项目,我使用了 ASP.Net 4 和具有 .svc 扩展名的 AppFabric 来托管代码。 (目前,AppFabric 在监视路由服务方面存在问题 - 因此需要 .svc 文件)
以下是有关 WCF 和 AppFabric 的一些更有用的链接:
我在 IIS 方法中看到的另一个优点是它允许您在旁边创建页面来帮助监视、维护、并配置服务。使用 Windows 服务,您必须手动编辑配置文件或创建一个应用程序来为您处理它。在我看来,能够在 WebForms/MVC 应用程序旁边托管 WCF 进行管理是一个巨大的优势。显然,您需要确保它以某种方式受到保护,以防止其他人窥视并查看状态/配置它。
With the release of AppFabric for IIS, hosting WCF services on IIS 7.5 has gotten a bit easier and more reliable. AppFabric allows you to configure services to start up on application pool start and prevent the pool from recycling like a normal web application. It also provides methods to allow your WCF service to log information about its health and monitor the service.
For my most recent WCF project, I've gone with ASP.Net 4 and AppFabric with .svc extensions for hosting the code. (Currently, AppFabric has issues monitoring services that are routed - so an .svc file is required)
Here are a couple more useful links about WCF and AppFabric:
Another advantage I've seen in the IIS method is it allows you to create pages next to it to help monitor, maintain, and configure the services. With a Windows Service you have to either edit your config files by hand or create an application to handle it for you. The ability to host WCF next to WebForms/MVC applications for management is a huge plus in my book. Obviously, you'd need to make sure it's secured in some way to prevent others from peering in and seeing the status/configuring it.