2014-08-29 107 views
1

我偶爾會在通過YouTrackSharp發出API請求時收到錯誤的請求錯誤消息。只有在服務器上運行時纔會發生這種情況,如果我在本地調試應用程序(在IIS上運行,而不是在IIS Express上運行),它會適當地執行。有沒有人遇到過這種行爲,並有任何建議?YouTrackSharp - EasyHttp Bad Request

異常

YouTrackSharp.Infrastructure.InvalidRequestException: Bad Request ---> EasyHttp.Infrastructure.HttpException: BadRequest Bad Request 
    at EasyHttp.Http.HttpClient.ProcessRequest(String filename) 
    at YouTrackSharp.Infrastructure.Connection.MakePostRequest(String command, Object data, String accept) 
    at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2](CallSite site, T0 arg0, T1 arg1, T2 arg2) 
    at YouTrackSharp.Issues.IssueManagement.ApplyCommand(String issueId, String command, String comment, Boolean disableNotifications, String runAs) 

長途區號

issueManagement.ApplyCommand(issue.Id, 
    string.Format("Ready For Testing Versions {0}", version), 
    string.Format("Marked Ready for Testing for {0} build, compiled {1}, by {2}", 
    version, utcDate.ToLocalTime(), user.UserName), 
    true); 

public void ApplyCommand(string issueId, string command, string comment, bool disableNotifications = false, string runAs = "") 
{ 
    if (!_connection.IsAuthenticated) 
    { 
     throw new InvalidRequestException(Language.YouTrackClient_CreateIssue_Not_Logged_In); 
    } 

    try 
    { 
     dynamic commandMessage = new ExpandoObject(); 


     commandMessage.command = command; 
     commandMessage.comment = comment; 
     if (disableNotifications) 
      commandMessage.disableNotifications = disableNotifications; 
     if (!string.IsNullOrWhiteSpace(runAs)) 
      commandMessage.runAs = runAs; 

     _connection.Post(string.Format("issue/{0}/execute", issueId), commandMessage); 
    } 
    catch (HttpException httpException) 
    { 
     throw new InvalidRequestException(httpException.StatusDescription, httpException); 
    } 
} 
+0

你能輕易再現這個嗎?如果是的話,你可以使用Fiddler來查看請求是什麼? – wal 2014-08-29 23:06:17

+0

容易嗎?不,但是當它發生時,它通常會發生多次,所以我會看看我能做些什麼來獲得提琴手捕捉並將其發佈到此處。 – invertigo 2014-09-02 20:06:19

回答

0

的問題最終是奇YouTrack API的執行方式正在執行我正在使用的命令。我發生了跨越YouTrack日誌,並且錯誤被記錄在那裏。對明智之詞:當您看到此錯誤消息時,請檢查YouTrack日誌。