[英]Server throws an exception only when debugging
我有一个api调用,用于从3个字段的数据库中搜索对象。 (字符串,datetimestart,datetimeend)。 当我执行它时,它可以完美地工作:
entryAPI.entriesSearch = function (item) {
return $http.post("./api/search/", { Matter: item.Matter, StartDate: item.StartDate, EndDate: item.EndDate});
};
问题是,当我附加调试器并在调用中放置一个断点时,接收的项目似乎为空,并且显然会引发异常。
public HttpResponseMessage Post(Entities.TimeSheet.SearchFields item)
{
try
{
// do some stuff (that is correctly done when not debugging
// item value is null when debugging
}
这是我的SearchFields项目:
public class SearchFields
{
public string Matter { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
}
搜索工作正常,但是我现在想跟踪一些值,但我无法这样做,我不知道如何解决/搜索如何解决类似问题。
提前致谢。
我认为[FromBody]丢失了。
喜欢:
public HttpResponseMessage Post([FromBody] Entities.TimeSheet.SearchFields item)
{
try
{
// do some stuff (that is correctly done when not debugging
// item value is null when debugging
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.