我有一個WCF REST服務與WCF服務的應用程序所承載的下列合同:爲什麼我的WCF幫助頁面只顯示GET方法?
[ServiceContract]
public interface IService
{
[OperationContract]
[WebInvoke(Method="GET",
RequestFormat=WebMessageFormat.Json,
ResponseFormat=WebMessageFormat.Json,
UriTemplate="key/{key}")]
Task<string> GetDocumentInDefaultBucket(string key);
[OperationContract]
[WebInvoke(Method = "GET",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "bucket/{bucket}/key/{key}")]
Task<string> GetDocument(string bucket, string key);
[OperationContract]
[WebInvoke(Method = "POST",
RequestFormat = WebMessageFormat.Json,
BodyStyle= WebMessageBodyStyle.Wrapped,
UriTemplate = "doc")]
Task<bool> InsertDocumentInDefaultBucket(string doc);
[OperationContract]
[WebInvoke(Method = "PUT",
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "udoc")]
Task<bool> UpdateDocumentInDefaultBucket(string doc);
}
然而,顯示在WCF幫助頁只有GET方法:
我在配置文件中沒有明確定義的服務,我剛將以下代碼添加到application_start事件中:
RouteTable.Routes.Add(new ServiceRoute("", new WebServiceHostFactory(), typeof(Service)));
任何幫助表示讚賞。
更新1:同樣的項目就像其他類似的開發環境中的魅力。
UPDATE 2:OMG!它適用於IIS
我決定在我的兩個同事機器上測試同一個項目,它在兩種情況下都像一個魅力!這個問題似乎與我的環境無關。 –