此工厂上启用了手动寻址,因此发送的所有消息都必须进行预寻址。


vs添加 wcf服务,普通的WebService服务,直接用WSHttpBinding就可以了;

可这次有个客户,不是WS,而是用的WebPost,而且添加服务引用,App.config无法自动生成(估计服务器配置有问题);

就给他们要了他们自己调用的代码,配置文件居然是自己手动写的。。。


1、发现behaviors里多了一个WebHttpBehavior,所以代码填上;

2、报错,"此工厂上启用了手动寻址,因此发送的所有消息都必须进行预寻址。" 

    网上查了下,发现 有个帖子说, 配置了     behaviorConfiguration="webBehavior"    就不会报错了。

    所以,代码里,把 WSHttpBinding  改成  WebHttpBinding ,果然好了。




贴上代码:


                string strWmsUrl = "http://xxx:xx/xxxx.svc";

                //WSHttpBinding binding = new WSHttpBinding();
                //binding.MaxReceivedMessageSize = int.MaxValue;
                //binding.MaxBufferPoolSize = int.MaxValue;

                WebHttpBinding binding = new WebHttpBinding();
                binding.MaxReceivedMessageSize = int.MaxValue;
                binding.MaxBufferPoolSize = int.MaxValue;

                System.ServiceModel.EndpointAddress remoteAddress = new System.ServiceModel.EndpointAddress(new Uri(string.Format(strWmsUrl))); ;


                DcServiceClient svProxy = new DcServiceClient(binding, remoteAddress);

                svProxy.Endpoint.Behaviors.Add(new System.ServiceModel.Description.WebHttpBehavior());
                
                WMS_U_VENDOR_INFORMATION paramDTO = new WMS_U_VENDOR_INFORMATION();
                ResultMessage result = svProxy.AddVendorInfo(paramDTO);


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值