첨부 파일을 업로드하려고 할 때이 오류가 임의로 발생합니다.Rally API "전송 연결에서 데이터를 읽을 수 없습니다 : 연결이 닫혔습니다."
"전송 연결에서 데이터를 읽을 수 없습니다 : 연결이 으로 종료되었습니다."
테스트 트랙에서 데이터를 가져 와서 집계에 넣고 첨부 파일을 랠리에 삽입하는 C# RallyRestAPI를 사용하는 가져 오기 기능이 있습니다. 내 테스트 데이터에는 350k, 63k 및 43k 크기의 3 가지 첨부 파일이 있습니다. 가져 오기 도구를 실행할 때 다른 시간에 다른 업로드에 오류가 발생합니다. 그것에 대한 일관성이 없습니다. 때로는 세 가지 모두 실패하고, 두 번째 것은 실패하고 세 번째는 실패 할 것입니다. 스토리를 생성하고 업데이트하는 것은 시간이 걸리는 것처럼 보이므로 RallyRestAPI에서 타임 아웃을 변경하는 방법을 잘 모르겠습니다.
다른 사람들이 C# 및 Rally RestAPI를 사용하여이 문제를 보았습니까?
내 업로드 코드는 다음과 같습니다. Connect()를 호출하면 RallyRestAPI 객체가 반환되고 해당 객체에 기록됩니다. Rally에 전화 할 때마다 다시 로그인합니다 (이 작업을 수행해야하는지 여부는 확실하지 않음).
private string AddAttachment(string reference, string name, string content, long contentSize, string type) {
var restAPI = Connect();
try {
var attachmentContent = new DynamicJsonObject();
attachmentContent["Content"] = content;
attachmentContent["Workspace"] = _workspace["_ref"];
attachmentContent["Project"] = _target["_ref"];
var result = restAPI.Create("AttachmentContent", attachmentContent);
if (result.Success) {
_logger.Info("Attached the relevant AttachmentContent.");
}
else {
throw new LoggedException("Could not attach attachment to '" + reference + "' due to the following errors\n" + GetErrorList(result.Errors));
}
var attachmentContentRef = result.Reference;
// DynamicJSONObject for Attachment Container
var myAttachment = new DynamicJsonObject();
myAttachment["Workspace"] = _workspace["_ref"];
myAttachment["Project"] = _target["_ref"];
myAttachment["Artifact"] = reference;
myAttachment["Content"] = attachmentContentRef;
myAttachment["Name"] = Path.GetFileName(name);
var contentType = "image/jpg";
if (!string.IsNullOrEmpty(type)) {
switch (type.Trim().ToLower()) {
case "doc":
contentType = "document/text";
break;
default:
contentType = type;
break;
}
}
myAttachment["ContentType"] = contentType;
myAttachment["Size"] = contentSize;
result = restAPI.Create("Attachment", myAttachment);
if (result.Success) {
_logger.Info("Attached the relevant attachment.");
}
else {
throw new LoggedException("Could not attach attachment to '" + reference + "' due to the following errors\n" + GetErrorList(result.Errors));
}
return attachmentContentRef;
}
catch (Exception ex) {
throw new LoggedException("Unhandled exception occurred: ",ex);
}
}
주셔서 감사합니다. 몇 가지 질문 - 당신은 프록시를 사용하고 있습니까? 그리고 귀하의 코드에서 사용하는 Rally Webservices의 버전은 무엇입니까? –
아니요 프록시를 사용하지 않고 연결에 특정 API 버전을 지정하지 않았으므로 현재 버전이 1.37이라고 생각합니다. 업로드되는 데이터 인 "content"매개 변수는 'Convert.ToBase64String (fs)'을 사용하는 Base64String입니다. – trevleyb