我是 WCF 的新手,我正在构建一项服务来执行 CRUD 操作。我创建了一个带有两个参数的新 void 方法。我设置了一个断点并在调试模式下粘贴了这个 URL:
http://localhost:55152/WcfDataService.svc/AddNewNote()?ParamNoteTitle='dfdfdf'&ParamNoteText='dfdfdfdf'
这是我的代码:
[WebGet]
public void AddNewNote(string ParamNoteTitle, string ParamNoteText)
{
//My hardcoded values for now...
int ParentID = 8879;
int JobID = 1000088150;
int ContactID = 309;
Guid UserID = Guid.NewGuid();
string RelatedType = "Advertiser Contact";
bool IsShared = true;
tblNote N = new tblNote
{
NotesTitle = ParamNoteTitle,
NotesText = ParamNoteText,
ParentID = ParentID,
ContactID = ContactID,
JobID = JobID,
UserID = UserID,
GroupID = null,
RelatedType = RelatedType,
IsShared = IsShared
};
this.CurrentDataSource.tblNotes.Add(N);
this.CurrentDataSource.SaveChanges();
}
我收到 404 错误。我的查询字符串/URL 有问题吗?