Skip to main content
 首页 » 编程设计

c#之关于将 WCF 托管为 Windows 服务的问题

2024年02月20日9kerrycode

我有一个复杂的 WCF 服务,例如使用 TCP、WindowsLogin、CustomLogin 和事务。

这已托管在带有 WAS 的 IIS7 中,但为了获得更好的性能,我现在将尝试将其作为 Windows 服务移至自托管环境中。

但是在开始这个项目之前我遇到了一些问题:

  1. 我是否可以在不构建多个安装包的情况下安装同一服务的多个实例?

  2. WindowsLogin 和 CustomLogin 会像以前一样工作吗?

  3. 托管在 IIS 中的启动时间有时可能长达 1 分钟,我看到托管在 Windows 服务中时大约有 30 sek 的限制?我该如何处理?

  4. 在开始这个项目之前,还有什么我应该考虑的吗?

  5. 你有关于这个主题的文章可以推荐吗?

请您参考如下方法:

1.Will I be able to install multiple instances of the same service without building several installation packages?

是的,让您的服务名称在安装程序中可配置。端口也应该是可配置的,这样它就不会与其他实例冲突。

2.Will the WindowsLogin and CustomLogin work as before?

是

3.The startup time when hosted in IIS can sometimes be as long as 1 minute, I saw something about a 30 sek limit when hosted in a Windows Service? How do I handle this?

要么异步启动它,要么在你的 OnStart() 方法中调用 this.RequestAdditionalTime

4.Is there something else I should consider before starting this project?

这个问题真的很广泛,有点难以解决

5.Do you got article to recommend on this subject?

http://msdn.microsoft.com/en-us/library/ms733069.aspx