c# - 如何在 WCF 中获取 POST 请求数据?
问题描述
我有一个离子应用程序,我需要通过 wcf 服务将一个大字符串插入到数据库中。我在 POST 请求的正文中发送字符串。
我的角度方法看起来像这样 -
uploadPic(bugImage : any)
{
this.http.post("http://192.168.123.162/MyRestService/MyRestService.svc/ReportaBug", bugImage).subscribe(
(data:any) => {
console.log(data);
}
)
}
当我将请求检查到 chrome 的开发人员工具>网络时,请求的状态是好的,但是当我检查数据库时,插入的字符串是空白的。
这是我的服务代码-
[OperationContract]
[WebInvoke(Method ="POST", UriTemplate = "/ReportaBug/base64String={base64String}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json )]
void ReportaBug(string base64String);
如何从 WCF 中的正文中获取数据?无论我从我的角度代码发送什么字符串,似乎都没有被服务捕获。它只是将空白字符串插入数据库。我如何让这个工作?
解决方案
推荐阅读
- swift - 快速获取滚动方向
- python - 如何在表示图形的字典上行走并返回元素列表
- python - 提取熊猫中名称的值
- delphi - 在 TPathData 中切换特定颜色
- javascript - Can I get a only Dubai city address from Google Maps autocomplete?
- php - 如何通过 get_terms 函数中的帖子元限制术语
- linux-kernel - 获取 msi 中断时如何保证所有 DMA 数据写入 ram?
- android - 颤振列表值未更新
- sql-server - 使用表名更新记录的存储过程
- c# - '你调用的对象是空的。' 用于asp.net中gridview中的动态复选框