Silverlight 与 WCF 通信到底支不支持wsHttpBinding??

Lakers_24号程序员 2014-11-25 10:18:46
Silverlight 与 WCF 通信到底支不支持wsHttpBinding??

basicHttpBinding没有问题!而wsHttpBinding 会报错!!

https://localhost/Service/Service1.svc 服务不支持内容类型 text/xml; charset=utf-8。客户端与服务器的绑定可能不匹配。

...全文
248 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
vbfool 2014-11-25
  • 打赏
  • 举报
回复
你的客户端和服务端,都是wsHttpBinding么?
周美文 2014-11-25
  • 打赏
  • 举报
回复
推测可能是服务端的绑定和编码搭配有问题
vbfool 2014-11-25
  • 打赏
  • 举报
回复
我以前试过的netTcpBinding是可以的,wsHttpBinding没试验过,按说应该没问题。
  • 打赏
  • 举报
回复
引用 1 楼 vbfool 的回复:
你的客户端和服务端,都是wsHttpBinding么?
我发布出来的WCF 支持两种绑定方式,basicHttpBinding和wsHttpBinding 两种方式!

           string hostUri = App.Current.Host.Source.AbsoluteUri;
            hostUri = hostUri.Substring(0, hostUri.IndexOf("/ClientBin"));
            string svcUri = hostUri + "/Service/Service1.svc";
            BasicHttpBinding binding = new BasicHttpBinding();
            if (svcUri.Contains("https://"))
            {
                binding.Security.Mode = BasicHttpSecurityMode.Transport;
            }
            else
            {
                binding.Security.Mode = BasicHttpSecurityMode.None;
            }


            EndpointAddress address = new EndpointAddress(svcUri);

            _client = new UploadServiceSoapClient(binding, address);

8,756

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧