WCF服务能否返回其他服务?返回其他服务的WCF服务
代码:
[ServiceContract]
public interface IServiceA
{
[OperationContract]
IServiceB GetServiceB();
[ServiceContract]
public interface IServiceB
{
public class ServiceA : IServiceA
{
public IServiceB GetServiceB()
{
return new ServiceB();
}
,这是激活ServiceA形式调用ServiceB:铸造这样当
public partial class Form1 : Form
{
private void button1_Click(object sender, EventArgs e)
{
ServiceReference1.ServiceAClient client = new
ServiceReference1.ServiceAClient();
IServiceB serviceB = client.GetServiceB();
Ofcourse这不能因为GetServiceB进行()返回对象,而不是服务:
IServiceB serviceB = (ServiceB) client.GetServiceB();
我得到CommunicationException:“现有连接w由远程主机强行关闭“
YPU为什么要这么做呢?只需从客户端调用ServiceB! – Jocke 2013-02-28 15:28:07
我只想要1个端点。ServiceA将向我展示许多对象,我不想要许多端点 – ilansch 2013-02-28 15:28:54
您正在寻找的是发现服务体系结构 – Dhawalk 2013-02-28 15:44:12