通过YouTrackSharp进行API请求时,我偶尔会收到一条错误的请求错误消息。只有在服务器上运行时才会发生这种情况,如果我在本地调试应用程序(在IIS上运行,而不是在IIS Express上运行),它就会正常运行。以前有人经历过这种行为吗?有什么建议吗?
例外
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);
}
}