从单一的WCF服务的多个接口? [英] Multiple interfaces from a single WCF service?

查看:432
本文介绍了从单一的WCF服务的多个接口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以将单个的WCF服务提供多个接口,如果是的话你会如何在的app.config

Can a single WCF service offer multiple interfaces, and if so how would you express this in app.config?

我指的是一个服务于一个终端提供多种接口。

I mean one services offering several Interfaces on one endpoint.

推荐答案

首先,你必须清楚什么是服务。你的意思是一个端点,或在同一主机上的多个端点?

First you need to be clear what a service is. Do you mean a single endpoint, or multiple endpoints in the same host?

假设你的意思是一个端点,然后是的,但有一点工作。一个端点只能实现一个单一的接口;所以你需要做的是你要实现的接口组合成一个单一的接口

Assuming you mean a single endpoint, then yes, but with a little work. An endpoint can only implement a single interface; so what you need to do is combine all the interfaces you want to implement into a single interface

public interface IMyInterface : IInterface1, IInterface2

,然后实现他们都在你的实现类。什么,你不能做的是有多个接口和多种实现神奇合并成一个单一的端点。

and then implement them all inside your implementation class. What you cannot do is have multiple interfaces and multiple implementations magically merge into a single endpoint.

这篇关于从单一的WCF服务的多个接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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