求助 C#请求WCF服务 报415错误 多谢

weixin_38051538 2019-04-28 03:57:14
WCF 接口定义为 控制台调用方法如下 控制台如果添加服务引用 生成代理类访问可以成功请求 但是像这样访问 就会报415错误 用postman也是这个错误 什么问题啊 快懵逼了 详细错误 StatusCode: 415, ReasonPhrase: 'Cannot process the message because the content type 'application/json; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.', Version: 1.1, Content: System.Net.Http.StreamContent, Headers: { X-SourceFiles: =?UTF-8?B?RTpcQ29kZVxNZW5nR3VhbmdIUlxNRy5IUi5XQ0ZTZXJ2aWNlXEFjdGl2aXRpV0ZTZXJ2aWNlLnN2Y1xhcGlcVGFza0NoYW5nZWQ=?= Cache-Control: private Date: Sun, 28 Apr 2019 07:12:39 GMT Server: Microsoft-IIS/10.0 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Content-Length: 0 }
...全文
162 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_38058113 2019-04-29
  • 打赏
  • 举报
回复
首先要确定一点你的wcf  服务是否基于restful, 具体查看配置:binding="webHttpBinding"。

430

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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