Est*_*aya 7 .net wcf web-services
我们的服务有一些仅通过net.tcp支持的设置.添加另一个端点的最佳方法是什么?我需要创建一个全新的主机吗?
您可以在服务器或客户端上定义多个端点.
要在客户端上执行此操作,您只需使用具有不同名称的新端点编辑app.config文件,然后定义何时创建新客户端.
例如,如果您的客户端应用程序中有一个端点,例如:
<endpoint address="https://yourdomain.com/WCF/YourService.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IYourService"
contract="MessagingService.IYourService"
name="BasicHttpBinding_IYourService" />
Run Code Online (Sandbox Code Playgroud)
你打电话给:
YourServiceClient client = new YourServiceClient();
Run Code Online (Sandbox Code Playgroud)
您可以使用新名称添加新端点:
<endpoint address="https://yourotherdomain.com/WCF/YourService.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IYourService"
contract="MessagingService.IYourService"
name="BasicHttpBinding_IYourService_ENDPOINT2" />
Run Code Online (Sandbox Code Playgroud)
你可以打电话给:
YourServiceClient client = new YourServiceClient("BasicHttpBinding_IYourService_ENDPOINT2");
Run Code Online (Sandbox Code Playgroud)
我刚刚更改了上面的域,但是如果你创建了一个新的绑定配置部分,你可以只更改"bindingConfiguration"值.