我有一个Silverlight启用WCF服务的网站。该服务工作正常,我可以浏览到WSDL页面中没有任何问题的浏览器。

现在,我想在DLL中创建一个客户端。我需要以编程方式,虽然创造了整个客户端,因为它被调用的DLL,它无论出于何种原因(按设计?)不会读取自己的配置文件中的ServiceModel部分。

因此,这里是我的代码:

Dim endp As EndpointAddress = New EndpointAddress("http://www.mydomain.com/licensing/lic.svc")
Dim bind As WSHttpBinding = New WSHttpBinding()
Dim svc = New lnt.licClient(bind, endp)
Dim rsp = svc.CheckIt(key)

但是,当我调用svc.CheckIt方法,得到以下错误:

Content Type application/soap+xml; charset=utf-8 was not supported by service http://www.mydomain.com/licensing/lic.svc. 
The client and service bindings may be mismatched.
{"The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'application/soap+msbin1'.."}

我如何正确地创建我的客户,使这些正确“匹配” - 点击 由于事先!!!

有帮助吗?

解决方案

阿---发现它。在 ServiceModel 在网站的web.config部分被设置为 customBinding 。改之以所匹配的客户端被发送,现在它精美的作品。

其他提示

我遇到了同样的问题。更多spefically我的修复是更新我用绑定的类型。我是用wsHttpBindings代替basicHttpBindings的。这是导致故障如wsHttpBindings使用SOAP 1.2而basicHttpBindings使用SOAP 1.1和我用所需的SOAP 1.1服务

我有同样的错误。服务被编译,客户aplication了。在客户端aplication服务引用被成功地更新参考。我试着删除,并再次添加引用,并将它was'nt乐于助人。问题是在网络服务中删除接口。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top