问题描述
我有一个API控制器,该控制器返回一个字节数组,一个CSV文件,该文件会被截断。 是否有任何配置设置会截断响应?
代码如下:
[HttpGet]
[ApiVersion("1.0")]
[Route("ProcessedData")]
[ProducesResponseType(typeof(FileContentResult),200)]
[ProducesResponseType(typeof(BusinessLogic.Dto.PagedProcessedData),200)]
[ProducesResponseType(typeof(BusinessLogic.Dto.BadRequest),400)]
public ActionResult GetProcessedData(int surveyID,int page = 1,string format = "json",DateTime? startDate = null,DateTime? endDate = null,string adm0Codes = null,int? marketID = null,string surveyType = null)
{
try
{
byte[] file = Models.Repository.Survey.GetSurveyProcessedDataAsCSV(surveyID);
if (file.Length == 0)
{
return BadRequest(new
{
Error = "No data available. Processed data becomes available after 24hrs from the upload. Please return after 24 hours."
});
}
else
{
return File(file,"application/octet-stream","MFI-ProcessedData.csv");
// -> it returns a truncated file,always after 1,287,168 chars.
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)