0

我在控制台应用程序中使用了 wcf soap 服务,我想在我的 app.config 中使用 dev url。

我总是失败,错误是

EndpointDispatcher 的 ContractFilter 不匹配

我认为端点与 wcf 服务 url 不匹配,因为缓慢的 cheetah 转换失败。

 <endpoint address="http://wsvc01/xxxDev/xxx.svc" binding="basicHttpBinding"
            bindingConfiguration="BasicHttpBinding_ixxx" contract="xxxServiceReference.ixxx"
            name="BasicHttpBinding_ixxx" xdt:Transform="Replace" xdt:Locator="Match(address)" />
</client>

我想要的是在调试时替换地址。

4

2 回答 2

0

如果要动态配置端点,则不能使用此处显示的配置文件方法。相反,您可以在程序启动时在运行时配置所有这些内容,使用变量根据条件更改 Web 服务端点的 URL。

这是 Stackoverflow 中对同一主题的引用: WCF 在运行时更改端点地址

这是另一个链接: http: //www.packtpub.com/article/microsoft-wcf-hosting-and-configuration

于 2014-01-08T13:27:28.340 回答
0

通过帮助我自己弄清楚了。尝试 SetAttributes 转换:

 <system.serviceModel>       
        <client>           
            <endpoint name="BasicHttpBinding_IMasterEngineService"
address="http://productionServer/WebServices/MasterEngine/MasterEngineService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMasterEngineService"
contract="OverlayFarEnd.IMasterEngineService" name="BasicHttpBinding_IMasterEngineService"
xdt:Transform="SetAttributes(address)" xdt:Locator="Match(name)"/>
        </client>
    </system.serviceModel>
于 2014-01-08T14:08:59.710 回答