1
我有一個WCF服務,我已經添加了RESTful支持。 GET/POST在我的本地IIS上運行。但是在服務器上的帖子給我了以下錯誤:WCF Rest服務POSTS在本地IIS上但不在服務器上(GET在兩者中都有效)
The incoming HTTP request's URI ' http://myserver:9002/StudyService.svc/rest/RestAuthenticateUser ' does not match any service operation.
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "/RestAuthenticateUser", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
authResultDTO RestAuthenticateUser(AuthRequest authRequest);
public authResultDTO RestAuthenticateUser(AuthRequest authRequest)
{
...
}
我通過郵差發布:http://myserver:9002/StudyService.svc/rest/RestAuthenticateUser
content-type: application/json
body: raw JSON
{
"DomainName": "Local",
"UserID": "myuser",
"Password": "mypassword"
}
我期待到.NET服務器上安裝。我在想,也許這更多的是環境問題而不是編碼?
目標框架:.Net Framework 4.5
任何想法如何解決這個問題?
我會給第二個選項一試。我已經更新了我的問題,以便更清楚地瞭解服務器和開發計算機之間的作用和不作用。 – ginalster
我不知道這是如何工作在您的本地IIS上,因爲您無法在Post請求中傳遞多個參數,以及正文(大寫)和函數(小寫)之間的參數名稱不同。 –
第二個選項與DataContract和DataMember是修復。 – ginalster