休息WCF Post方法中有400个错误请求?

时间:2011-12-21 12:04:41

标签: entity-framework-4

我的代码是:

[WebInvoke(ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml, UriTemplate = "InsertUser", Method = "POST")]
        public int InsertUser(Sales_Data instance)
        {
            using (DataEntities cxt = new DataEntities())
            {
                Sales_Data visitor = new Sales_Data();
                visitor.fname = instance.fname;
                visitor.email = instance.email;
                visitor.phone = instance.phone;

                cxt.AddToSales_Data(visitor);
                cxt.SaveChanges();

                return visitor.ID;
            }
        }

请求输入:

 <Sales_Data>
                        <fname>ff</fname>
                        <email>ggg</email>
                       <phone>4444</phone>
                      </Sales_Data>

然后在休息客户端测试时,我收到400 Bad Request。

请求输入中是否有任何错误。

0 个答案:

没有答案