C# 从Win32服务调用WCF服务时,我遇到System.StackOverflowException异常
我有win32服务,每3秒钟通过WCF服务轮询一次数据库, 20小时后,我得到了一个例外: “System.StackOverflowException”类型的未处理异常 在win32服务的System.dll中发生C# 从Win32服务调用WCF服务时,我遇到System.StackOverflowException异常,c#,.net,web-services,wcf,windows-services,C#,.net,Web Services,Wcf,Windows Services,我有win32服务,每3秒钟通过WCF服务轮询一次数据库, 20小时后,我得到了一个例外: “System.StackOverflowException”类型的未处理异常 在win32服务的System.dll中发生 var methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; var traceProperties = new Dictionary<string
var methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
var traceProperties = new Dictionary<string, object>();
Logger.LogTrace("Start ", methodName, traceProperties);
Com.Softechww.Services.ContentInfo.EncodingJobs jobs = null;
try
{
jobs = _contentSvc.GetEncodingJobs(encodingSearchCriteria);
}
catch (Exception ex)
{
Logger.LogError(ex, methodName, traceProperties);
throw;
}
Logger.LogTrace("End", methodName, traceProperties);
return jobs;
谁能告诉我,怎么了,为什么会这样
下面是从Win32服务调用WCF服务的示例代码
var methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
var traceProperties = new Dictionary<string, object>();
Logger.LogTrace("Start ", methodName, traceProperties);
Com.Softechww.Services.ContentInfo.EncodingJobs jobs = null;
try
{
jobs = _contentSvc.GetEncodingJobs(encodingSearchCriteria);
}
catch (Exception ex)
{
Logger.LogError(ex, methodName, traceProperties);
throw;
}
Logger.LogTrace("End", methodName, traceProperties);
return jobs;
当由于嵌套函数调用过多而耗尽堆栈空间时,会发生StackOverflowException。一个明显的检查是看您是否正在进行任何递归调用。不,它只是在调用WCF方法,没有递归调用。发布GetEncodingJobs的代码-您可能会遇到递归或无限循环的情况。