WCF - 内容类型text / xml;服务不支持charset = utf-8 [英] WCF - Content Type text/xml; charset=utf-8 was not supported by service
问题描述
我有一个wcf服务有问题。
我有一个控制台aplication我需要在不使用app.config的情况下使用服务,所以我必须通过代码设置endoint等。
我有一个服务参考svc,但我无法使用app.config。
这是我的代码:
Hi,
I Have a problem with a wcf service.
I have a console aplication and I need to consume the service without using app.config, so I had to set the endoint, etc by code.
I do have a service reference to the svc, but I cant use the app.config.
Here''s my code:
BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
EndpointAddress endpoint =
new EndpointAddress("http://localhost:XXXX/_vti_bin/Testingapp.svc/mex");
string internetList = "Interaktor - Henvendelser";
string internetSite = "http://localhost:20311 ";
string ggt = ww.DoWork();
在我做ww.DoWork()的最后一行,我得到了错误:
内容类型text / xml;服务http:// localhost:8731 / WcfServicio / MiServicio不支持charset = utf-8。客户端和服务绑定可能不匹配。
任何建议??
At the last line when I do ww.DoWork(), I get the error:
Content Type text/xml; charset=utf-8 was not supported by service http://localhost:8731/WcfServicio/MiServicio. The client and service bindings may be mismatched.
Any suggestions??
推荐答案
我认为这是由于客户端和服务配置之间的绑定不匹配。通常wsHttpBinding支持SOAP 1.2,basicHttpBinding支持SOAP 1.1。因此,如果它们之间存在不匹配,则可能导致此类问题。请检查您的服务配置。
I think this is due to Binding mismatch between client and service configuration. Generally wsHttpBinding Supports SOAP 1.2 and basicHttpBinding suppors SOAP 1.1 . So if there is a mismatch between them that can cause such issue. Please check your service configuration.
这篇关于WCF - 内容类型text / xml;服务不支持charset = utf-8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!