Asp.Net MVC中递归死循环问题
在写代码的时候,很欢乐地发现报错了。
An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
具体图示如下:
后来才发现自己写了一段多余的代码导致其不停循环往复陷入死循环。
public class ConformanceListRepository { private readonly ConformanceListService _conformanceListService; public ConformanceListRepository(ConformanceListService conformanceListService) { _conformanceListService = conformanceListService; } }
这里是在Repository中出了问题。
所以解决思路是寻找可能出现死循环的地方,通常是像我上面这样,自己调用了自己(_conformanceListService调用ConformanceListRepository,然后循环往复)
** Then I looked up at the sky and saw the sun **
posted on 2017-09-08 09:23 chenyangsocool 阅读(451) 评论(0) 编辑 收藏 举报