简体   繁体   English

C#15分钟后停止加载数据

[英]stop loading data after 15 min c#

I am writing an website where I get some data from the database. 我正在写一个网站,可以从数据库中获取一些数据。 When starting the website on my computer I get the data for 15 min. 在计算机上启动网站时,我得到了15分钟的数据。 After these 15 min the files don't load anymore. 在这15分钟之后,文件将不再加载。

在此处输入图片说明

When I restart the backend (Visual Studio C#) then it happens the same. 当我重新启动后端(Visual Studio C#)时,它也会发生相同的情况。

Controller from the file: 控制器从文件:

[UnitOfWorkActionFilter]
[RoutePrefix("categories")]
public class CategoriesController : ApiController {
    private ICategoriesProcessor _categoriesProcessor;
    private IPagedDataRequestFactory _pagedDataRequestFactory;
    public CategoriesController(ICategoriesProcessor categoriesProcessor, IPagedDataRequestFactory pagedDataRequestFactory) {
        _pagedDataRequestFactory = pagedDataRequestFactory;
        _categoriesProcessor = categoriesProcessor;
    }

    [Route()]
    [HttpGet]
    public PagedResponse<Category> GetCategories(HttpRequestMessage requestMessage) {
        var request = _pagedDataRequestFactory.Create(requestMessage.RequestUri);
        return _categoriesProcessor.GetCategories(request);
    }
}

here is the code from the UnitWorkActionFilterAttribute 这是来自UnitWorkActionFilterAttribute的代码

 public class UnitOfWorkActionFilterAttribute : ActionFilterAttribute {
    public virtual IActionTransactionHelper ActionTransactionHelper { get { return WebContainerManager.Get<IActionTransactionHelper>(); } }
    public override bool AllowMultiple { get { return false; } }
    public override void OnActionExecuting(HttpActionContext actionContext) {
        ActionTransactionHelper.BeginTransaction();
    }
    public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) {
        ActionTransactionHelper.EndTransaction(actionExecutedContext);
        ActionTransactionHelper.CloseSession();
    }
}

I found out that the problem is, that the Session opens but not close but I don't know how to fix it. 我发现问题是会话打开但没有关闭,但是我不知道如何解决。

Does someone has an idea why it's not working? 有人知道为什么它不起作用吗?

have you try access from Fiddler ??? 您尝试从Fiddler访问吗? what the client you used to call your API... see what the fiddler got message, and if you call the API, that is call that Method API or not...need detail information, this error have come to method or just in client stuff... 您用来调用API的客户端是什么...查看提琴手收到的消息,如果您调用API,即是否调用该方法API ...需要详细信息,则此错误已传给method或in客户资料...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM