【发布时间】:2014-03-14 16:41:09
【问题描述】:
我已经构建了一个 WCF 服务,我正在使用 android 客户端。我有这个方法:
[WebInvoke(
Method = "POST",
UriTemplate = "syncfromserver/",
BodyStyle = WebMessageBodyStyle.Bare,
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json)]
Message SyncFromServer(LocalDatabaseModel tc);
它运行良好。然后我需要向方法发送另一个参数,然后我像这样编辑它:
[WebInvoke(
Method = "POST",
UriTemplate = "syncfromserver/token={token}",
BodyStyle = WebMessageBodyStyle.Bare,
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json)]
Message SyncFromServer(string token, LocalDatabaseModel tc);
当我尝试时,我不断收到错误,所以我想回到以前的工作版本,但现在它不能工作了!?我已经删除了所有更改,但似乎服务器以某种方式记住了它们,并且我不断收到 405 错误,“不允许用于访问此页面的 HTTP 动词”。有人帮忙吗?
【问题讨论】:
-
我会说!您的更高版本应该可以工作。尝试交换参数,即 Message SyncFromServer(LocalDatabaseModel tc, string token);看到这个答案stackoverflow.com/questions/21912454/…