簡體   English   中英

服務器僅在調試時才引發異常

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM