如何解决使用邮递员测试WCF服务
我开发了我的第一个WCF服务,我想使用邮递员进行测试,但是我不断收到404 not found错误。 我使用WCFClient对其进行了测试,并且工作正常。 我的模特
[DataContract]
public class chatbotModel
{
[DataMember]
public System.Guid id { get; set; }
[DataMember]
public string subject { get; set; }
[DataMember]
public Nullable<System.DateTime> date_started { get; set; }
}
我的功能:
public bool InsertchatbotData(chatbotModel model)
{
using (var chatbotContext = new regacrmEntities())
{
var id = Guid.NewGuid();
var Newchatbot = new a01_chatbot()
{
id = id,date_entered = model.date_started,date_modified = model.date_ended,name = model.subject,description = model.description
};
chatbotContext.a01_chatbot.Add(Newchatbot);
chatbotContext.SaveChanges();
return true;
}
}
[ServiceContract]
public interface ICrmService
{
[OperationContract]
[WebInvoke(Method = "POST",RequestFormat = Webmessageformat.Xml,UriTemplate = "InsertchatbotData")]
bool InsertchatbotData(chatbotModel model);
}
SOAPAction:http://tempuri.org/ICrmService/InsertChatBotData
解决方法
这是因为您访问了错误的URL,建议您启用帮助文档。这是一个演示:
<endpointBehaviors>
<behavior name="ESEndPointBehavior">
<webHttp helpEnabled="true"/>
</behavior>
</endpointBehaviors>
您需要将 ESEndPointBehavior 应用于端点。
然后,您可以在浏览器中访问帮助文档:
帮助文档包括请求的URL,http动词和请求的格式。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。