使用城堡为合同的命名端点创建 WCF 代理

时间:2021-04-06 12:17:48

标签: c# wcf endpoint castle

我正在使用带有“Castle.DynamicProxy.ProxyGenerator”的城堡使用代码创建WCF服务代理。这是创建频道的现有类:

public class ChannelProxyGenerator : IChannelProxyGenerator
{
    private readonly ProxyGenerator proxyGenerator;

    public ChannelProxyGenerator()
    {
        proxyGenerator = new ProxyGenerator();
    }

    public TInterface CreateCannelWithRetries<TInterface>(IServiceProxy<TInterface> serviceProxy) where TInterface : class
    {
        return proxyGenerator.CreateInterfaceProxyWithTargetInterface(serviceProxy.Channel);
    }
}

我希望能够创建代理,但通过指定其名称来使用特定端点,如 https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ee535060(v=office.14) 中所述。原因是我需要为同一个合约支持多个端点配置。

这可以使用 Castle 还是我应该使用其他替代方案?我没有看到任何支持它的重载。

0 个答案:

没有答案
相关问题