我在ASP.NET中遇到了某种限制.我将问题缩减为ASP.NET MVC项目(使用Visual Studio 2010和.NET 4创建)中的示例项目,问题仍然存在:
在MVC控制器中,我有一个提供文件下载的方法:
public ActionResult DownloadBigFile()
{
string file = @"C:\Temp\File.txt";
var readStream = new FileStream(file, FileMode.Open, FileAccess.Read);
return File(readStream, "text/plain", "FILE");
}
Run Code Online (Sandbox Code Playgroud)
当文件低于1 GB时,下载工作正常,超过1 GB时会抛出异常:"算术运算中出现溢出或下溢",其中包含以下详细信息:
Overflow or underflow in the arithmetic operation.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArithmeticException: Overflow or underflow in the arithmetic operation.
Source Error:
An …Run Code Online (Sandbox Code Playgroud) 我从我的ASP.NET核心应用程序向第三方API发出Web请求.
通过RestSharp客户端从Hangfire定期作业向Asana API端点(HTTPS)发出请求.所有自己的应用程序页面都可以通过IIS获得,但应用程序无法提出任何请求.
我应该在哪里查看和调试什么来解决这个问题?
我有一个.net核心网络api,端点之一运行存储过程,该过程需要3-4分钟才能完成。API已部署到IIS。
当我执行httpGet时,出现502 Bad Gateway错误。查看IIS日志,该错误实际上是超时。这来自IIS日志:
2018-11-28 17:24:48 10.71.12.59 GET /api/meetingreport fromDate=11/01/2018&toDate=11/30/2018&tradingGroup=All&symbol=&reviewed= 16000 - 10.6.50.61 Mozilla/5.0+(Windows+NT+6.1;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/64.0.3282.140+Safari/537.36 - 502 3 12002 120029
错误代码12202适用于ERR_WINHTTP_TIMEOUT。2分钟后发生超时。请求时间少于2分钟即可正常运行。我通过添加超过2分钟和不足2分钟的thread.sleep进行了检查。
[HttpGet("")]
public async Task<IActionResult> Get([FromQuery(Name = "fromDate")] DateTime fromDate,
[FromQuery(Name = "toDate")] DateTime toDate, [FromQuery(Name ="tradingGroup")]string tradingGroup, [FromQuery(Name = "symbol")]string symbol, [FromQuery(Name = "reviewed")]string reviewed)
{
try
{
if (fromDate == DateTime.MinValue || toDate == DateTime.MinValue) return BadRequest("fromDate and toDate is a required Field");
tradingGroup = tradingGroup == "All" ? tradingGroup.Replace("All", "") : tradingGroup;
tradingGroup = tradingGroup ?? …Run Code Online (Sandbox Code Playgroud)