没有.svc文件创建WCF服务 [英] Creating WCF service without .svc file

查看:226
本文介绍了没有.svc文件创建WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有运行,其中包含一个WCF服务几个文件的问题。这项服务是没有配置文件,并没有一个.svc文件创建的。是否有可能没有.svc文件运行服务。这些都是有自己完整的服务要求,如服务合同和操作合同2简单的C#类文件。

I am having issues running few files which contains a wcf service. The service is created without a config file and without a .svc file. Is it possible to run a service without a .svc file. These are 2 simple C# class files which have their full service requirements, like service contracts and operation contracts.

我试图从另一个类调用,但它给这个错误:与类库输出类型项目不能直接启动

I have tried it calling from another class, but it gives this error:"a project with an output type of class library cannot be started directly"

我的问题是:是不是需要有一个service.svc文件

my question is: is it necessary to have a service.svc file?

推荐答案

如果您不承载在IIS服务,没有必要的.svc。原因在IIS中的.svc是:

If you don't host your service in IIS, no need for .svc. The reason for .svc in IIS is:

在IIS托管WCF服务都表示为特殊的内容文件
(.SVC文件)IIS应用程序中。该模型是类似于
方式ASMX页IIS应用程序作为的.asmx
文件的内部表示。一个.svc文件包含一个特定的WCF处理指令
(@ServiceHost),允许WCF托管基础设施响应传入的消息激活
托管服务。

WCF services hosted in IIS are represented as special content files (.svc files) inside the IIS application. This model is similar to the way ASMX pages are represented inside of an IIS application as .asmx files. A .svc file contains a WCF-specific processing directive (@ServiceHost) that allows the WCF hosting infrastructure to activate hosted services in response to incoming messages.

这篇关于没有.svc文件创建WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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