C# JIRA SDK SaveChanges() 函数中出现不清楚的错误
C# JIRA SDK Unclear Error in SaveChanges() Function
我正在尝试创建一个 Web 表单,我可以在其中使用用户输入的任何内容动态创建 JIRA Epic。我依靠 Atlassian JIRA SDK Nuget 包来这样做。
这是目前的功能。
public ActionResult Create(string title, string description)
{
Jira jiraConnection = Jira.CreateRestClient("https://xxxx.atlassian.net/", "username", "password");
Issue issueMain = jiraConnection.CreateIssue("xxxx");
issueMain.Type = "Epic";
issueMain.Priority = "Major";
issueMain.Summary = title;
issueMain.Description = description;
try
{
issueMain.SaveChanges();
}
catch (Exception ex)
{
MessageBox.Show(ex.InnerException.Message.ToString());
return View("Contact");
}
return RedirectToAction("Index");
}
我在尝试实际创建问题时遇到了一些不同的错误,但目前困扰我的是:
error CS0103: The name 'client' does not exist in the current context
当我点击 issueMain.SaveChanges()
行时,我遇到了这个错误,我不知道为什么,因为我没有在这个函数的任何地方实例化一个 "client" 变量,我不能进入 SaveChanges 函数以查看它可能在其中被引用的位置。
当我检查内部异常时,我发现我遇到了一个 Encountered a 401 - Unauthorized error while loading this page
错误,我也不明白这个错误,因为我提供了通常用于登录我们的帐户的凭据吉拉网站。
我找到了 Atlassian Jira SDK 文档的 link:
https://bitbucket.org/farmas/atlassian.net-sdk/wiki/Home
看来您需要在创建问题时添加Type
和Priority
这两个属性。
issueMain.Type = "Bug";
issueMain.Priority = "Major";
我正在尝试创建一个 Web 表单,我可以在其中使用用户输入的任何内容动态创建 JIRA Epic。我依靠 Atlassian JIRA SDK Nuget 包来这样做。
这是目前的功能。
public ActionResult Create(string title, string description)
{
Jira jiraConnection = Jira.CreateRestClient("https://xxxx.atlassian.net/", "username", "password");
Issue issueMain = jiraConnection.CreateIssue("xxxx");
issueMain.Type = "Epic";
issueMain.Priority = "Major";
issueMain.Summary = title;
issueMain.Description = description;
try
{
issueMain.SaveChanges();
}
catch (Exception ex)
{
MessageBox.Show(ex.InnerException.Message.ToString());
return View("Contact");
}
return RedirectToAction("Index");
}
我在尝试实际创建问题时遇到了一些不同的错误,但目前困扰我的是:
error CS0103: The name 'client' does not exist in the current context
当我点击 issueMain.SaveChanges()
行时,我遇到了这个错误,我不知道为什么,因为我没有在这个函数的任何地方实例化一个 "client" 变量,我不能进入 SaveChanges 函数以查看它可能在其中被引用的位置。
当我检查内部异常时,我发现我遇到了一个 Encountered a 401 - Unauthorized error while loading this page
错误,我也不明白这个错误,因为我提供了通常用于登录我们的帐户的凭据吉拉网站。
我找到了 Atlassian Jira SDK 文档的 link: https://bitbucket.org/farmas/atlassian.net-sdk/wiki/Home
看来您需要在创建问题时添加Type
和Priority
这两个属性。
issueMain.Type = "Bug";
issueMain.Priority = "Major";