关于 wcf 服务托管 [英] Regarding wcf service hosting

查看:24
本文介绍了关于 wcf 服务托管的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 wcf 的新手并开始学习.我有一个困惑,比如我创建了一个小的 wcf 服务,只是不在 IIS、控制台应用程序或 win 服务中托管它,但是从另一个应用程序我可以添加 svc 文件的服务引用并发现它正在工作.如果 wcf 可以在不托管在IIS、控制台应用程序或赢得服务"等任何地方的情况下工作,那么为什么人们总是在 IIS、控制台应用程序或赢得服务中托管 wcf 服务.谁能告诉我原因.

i am new in wcf and started learning. i got one confusion like that i create a small wcf service and just do not host it in IIS,console apps or win service but from another apps i can add the service reference of svc file and found it is working. if wcf can work without hosting in any place like "IIS,console apps or win service " then why people would alway host wcf service in IIS,console apps or win service. can anyone tell me the reason.

推荐答案

人们通常使用 IIS 和 Windows 服务,因为它们更易于设置且运行更一致.它们也可以更轻松地托管在可以将服务配置为自动启动的服务器上,并且通常 wcf 用作服务器通信方法,通常您想要这样做.

people use IIS and windows services in general because they are simpler to setup and run more consistently. they can also be hosted more easily on servers where the services can be configured to start automatically, and as usually wcf is used as a server communication method it is usually this that you want to do.

当您想在本地测试服务时,对于用于测试目的的简单示例,在控制台应用程序中托管通常更容易设置.

hosting in console applications is generally easier to setup for simple examples for testing purposes, when you want to test your services locally.

虽然尽可能在应用程序中托管,但使用 wcf 在同一台机器上的 2 个应用程序之间进行通信的情况不太常见.

Whilst hosting in applications as possible it's a less common scenario to use wcf to communicate between 2 applications on the same machine.

您最初的问题是问为什么人们总是谈论 IIS、服务等.我的意思是 wcf 通常用于 Web 服务,并且通常在本地计算机以外的服务器上运行.即使它可以用于同一台机器上的进程间通信,这也不是最常见的用例.这就是为什么您会看到大量使用 IIS 的示例,而没有太多将其托管在 Windows 窗体应用中的原因.

Your original question asked why people always talk about IIS, services etc. The point I was making was that usually wcf is used for web services, and is usually run on a server other than the local machine. Even though it can be used for inter process communication on the same machine this is not the most common use case. This is why you see a lot of examples using IIS and not too many hosting it in a Windows forms app.

这篇关于关于 wcf 服务托管的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆