0

我一直在OperationContract关注我的 WCF 服务;我HttpContext.Current.Request.Form["param"]用来检索提交的数据。

 [OperationContract]
 [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json)]
 public string authenticateUser()

我的 service.svc 文件包含<%@ ServiceHost Language="C#" Debug="true" Service="service.login" Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" %>

现在 POST 参数显示为空。我已经使用提琴手检查了请求。

这种方法对我有用了数周,直到我迁移到 VS 2012(这是我所做的唯一更改)并且我托管的 Azure 应用程序也可以正常工作。

还有其他方法可以获取 POST 数据吗?提前致谢。

4

1 回答 1

0

2 对此的想法

1)你为什么不像这样为你的方法传递参数?

[OperationContract]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json)]
public string authenticateUser(string param)

或者

2)如果这不是您的选择,我想知道放置此属性是否可以启用正常的 ASP.NET 管道,以便表单变量可用

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
于 2012-11-24T18:37:46.440 回答