动态配置服务参考C#

时间:2016-10-14 13:26:39

标签: c# .net web-services wcf

我正在使用服务引用,我想配置动态端点。

以下设置需要在源代码中完成,不一定是在web.config或app.config

这是可能的还是不好的做法?

配置

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="ProdutosCadastroSoap" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://app.omie.com.br/api/v1/geral/produtos/"
                binding="basicHttpBinding" bindingConfiguration="ProdutosCadastroSoap"
                contract="omieWS.Produto.ProdutosCadastroSoap" name="ProdutosCadastroSoap" />
        </client>
    </system.serviceModel>
</configuration>

0 个答案:

没有答案
相关问题