WCF多重绑定... [英] WCF Multiple Bindings....

查看:121
本文介绍了WCF多重绑定...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai朋友...

谁能帮忙,我有一个具有多个绑定的WCF服务,例如:basicHttpBinding和netTcpBinding,但是我的WCFService仅支持basicHttpBinding.我在webconfig文件1中为baseAddress ="http://localhost:8471/Design_Time_Addresses/WCFData/Service1"提供了2个BaseAddress,为baseAddress ="net.tcp://localhost:8732/Design_Time_Addresses/WCFData/Service1"提供了2 BaseAddress

但是它显示2个地址的编译错误,如果我给http然后工作正常.

Hai friends...

Can anybody help, i have a WCF Service with multiple bindings,Ex: basicHttpBinding and netTcpBinding, but my WCFService is supporting for basicHttpBinding only. I gave 2 BaseAddress in webconfig file 1 for baseAddress="http://localhost:8471/Design_Time_Addresses/WCFData/Service1" and 2 for baseAddress="net.tcp://localhost:8732/Design_Time_Addresses/WCFData/Service1"

But its showing compile error for 2 addresses, if i give http then working fine.

推荐答案



可能的原因之一是,由于服务配置了多个绑定(在本例中为http和tcp),代理的默认构造函数在客户端生成的代码中不起作用.您必须明确提及要使用的绑定的名称.


例如:

当一个服务有2个绑定时,这将不起作用
Hi,

One of the probable reason could be,since the service is configured for more than one binding(in this case http and tcp), The default constructor of the proxy ,In the generated code at the client wont work. you have to explicitly mention the name of the binding which you want to work with.


for ex:

This wont work when there are 2 bindings for a service
using( ServiceClient proxy = new ServiceClient())
{

}



您需要利用



you need to make use of

using( ServiceClient proxy = new ServiceClient("Give the name of the binding which u want to use"))
{

}



希望对您有所帮助!.

问候,
-Vinayak



I hope this helps!.

Regards,
-Vinayak


如果您正在使用配置文件配置多重绑定,请在此处发布< system.serviceModel>的所有元素.部分


如果您通过代码方式使用而没有配置文件,那么请在此处发布一段代码.

还要在此处发布您正在获取的异常消息.
If you are using Config file to configure multiples binding then please post here all elements of <system.serviceModel> section

OR
If you are using through code means without configuration file then please post here piece of code.

Also post here exception message which is you are getting.


这篇关于WCF多重绑定...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆