Sql System.ExecutionEngineeException未处理
我收到一个System.ExecutionEngineeException未从wcf服务处理 这是我的Iservice.cs代码Sql System.ExecutionEngineeException未处理,sql,wcf,linq,Sql,Wcf,Linq,我收到一个System.ExecutionEngineeException未从wcf服务处理 这是我的Iservice.cs代码 namespace MyService { [ServiceContract] public interface IService1 { [OperationContract] List<MyEmployee> FindEmployee(string uid); } } namespace-MyService { [
namespace MyService
{
[ServiceContract]
public interface IService1
{
[OperationContract]
List<MyEmployee> FindEmployee(string uid);
}
}
namespace-MyService
{
[服务合同]
公共接口IService1
{
[经营合同]
列出FindEmployee(字符串uid);
}
}
以及下面的Service1.svc.cs代码
namespace MyService
{
public class Service1 : IService1
{
public List<MyEmployee> FindEmployee(string uid)
{
DataClasses2DataContext context = new DataClasses2DataContext();
var res = from r in context.MyEmployees where r.EmpId == uid select r;
return res.ToList();
}
}
}
namespace-MyService
{
公共类服务1:IService1
{
公共列表FindEmployee(字符串uid)
{
DataClasses2DataContext上下文=新DataClasses2DataContext();
var res=来自context.MyEmployees中的r,其中r.EmpId==uid选择r;
return res.ToList();
}
}
}
如果我将List改为string并选择一列而不是整行,那么这段代码可以正常工作
提前感谢。*List您是这样尝试的:List lst=new List();lst=res.ToList();返回lst;谢谢Zaphod的回答。该解决方案不起作用,仍然得到相同的错误…(MyEmployee可序列化吗?如何检查MyEmployee是否可序列化?如何使MyEmployee可序列化?