WCF服务在POST中返回HTTP 405

时间:2015-06-22 03:20:43

标签: c# wcf iis-7.5 windows-server-2008-r2

我面临以下情况:当我使用GET(getUserByUID)调用WCF服务时,服务返回正确的数据。当我调用InsertUser时,服务器返回HTTP错误405 Method not allowed。

我认为这可能是服务器配置问题。我已经搜索了很多,但没有找到解决方案。

环境是带有IIS7.5的Win2008R2

提前谢谢你,

[ServiceContract]
public interface IUserService
{
    [OperationContract]
    [WebGet(BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json,
    ResponseFormat = WebMessageFormat.Json, UriTemplate = "GetUserById?x={uid}")]
    User getUserByUID(string uid);

    [OperationContract]
    [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json,
    ResponseFormat = WebMessageFormat.Json, UriTemplate = "InsertUser")]
    string InsertUser(User user);

1 个答案:

答案 0 :(得分:0)

@Mairaj Ahmad感谢您的帮助。

我发现了错误。我甚至在从IIS中删除了它后,我在IIS中使用了WebDAV Handler Mapper。

我删除了条目并且服务有效。

相关问题