gpt4 book ai didi

c# - 为什么/如何将自承载 WCF 服务迁移到 IIS7?

转载 作者:行者123 更新时间:2023-11-30 14:17:51 25 4
gpt4 key购买 nike

我编写了一些 WCF 服务,出于开发和调试目的,我以自托管的方式运行这些服务。现在我已经启动了一个 Web 服务器,我正在考虑是否有任何理由将我的服务更改为在 IIS 7 下运行...如果是,如何?..

最佳答案

MSDN 有一篇文章探讨了不同的 WCF hosting楷模。这是关于自托管的内容:

The following are the advantages of self-hosting:

  • Is easy to use: With only a few lines of code you have your service running.
  • Is flexible: You can easily control the lifetime of your services through the Open() and Close() methods of ServiceHost.
  • Is easy to debug: Debugging WCF services that are hosted in a self-hosted environment provides a familiar way of debugging, without having to attach to separate applications that activate your service.
  • Is easy to deploy: In general, deploying simple Windows applications is as easy as xcopy. You don't need any complex deployment scenarios on server farms, and the like, to deploy a simple Windows application that serves as a WCF ServiceHost.
  • Supports all bindings and transports: Self-hosting doesn't limit you to out-of-the-box bindings and transports whatsoever. On Windows XP and Windows Server 2003, IIS limits you to HTTP only.

The following are the disadvantages of self-hosting:

  • Limited availability: The service is reachable only when the application is running.
  • Limited features: Self-hosted applications have limited support for high availability, easy manageability, robustness, recoverability, versioning, and deployment scenarios. At least, out-of-the-box WCF doesn't provide these, so in a self-hosted scenario you have to implement these features yourself; IIS, for example, comes with several of these features by default.

关于c# - 为什么/如何将自承载 WCF 服务迁移到 IIS7?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5391255/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com