WCF服务从应用程序访问时出错 [英] WCF sevice Error when accessing from application
问题描述
您好,
i创建了REST ApI服务并在IIS 7.5中进行了管理。但是当我通过Web应用程序访问服务时,我收到了像
$ b这样的消息$ b远程服务器返回错误:(415)无法处理消息,因为内容类型''application / xml; charset = utf-8''不是预期的类型''application / soap + xml; charset = utf -8''..
为解决此问题,我将内容类型更改为application / soap + xml; charset = utf-8。这个问题已修复,但我有另一个问题,比如
远程服务器返回错误:(400)错误请求
请帮帮我。
先谢谢你。
Hello,
i created wcf REST ApI service and hosed in IIS 7.5.but when i accessing service through web application i got message like
"The remote server returned an error: (415) Cannot process the message because the content type ''application/xml; charset=utf-8'' was not the expected type ''application/soap+xml; charset=utf-8''.. "
For fixing this issue i changed the content type to "application/soap+xml; charset=utf-8". this issue is fixed but i got another issue like
"The remote server returned an error: (400) Bad Request"
Please Help me.
Thank you in Advance.
推荐答案
使用内容键入text / xml
,如下所示。
Use Content Typetext/xml
as below.
req.ContentType = "text/xml";
您也可以参考我的提示/技巧调试WCF REST服务。
调试WCF REST服务。
从我的服务方法返回自定义列表对象而不是字符串,并读取数据并绑定到应用程序中的gridview控件。
returning customlist object instead of string from my service method and read the data and bind to gridview control in application.
这篇关于WCF服务从应用程序访问时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!