我有一个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
我决定在我的两个同事机器上测试同一个项目,它在两种情况下都像一个魅力!这个问题似乎与我的环境无关。 –