[WebMethod]
public engineer getItem()
{
DataClasses1DataContext db = new DataClasses1DataContext();
List<string> list = new List<string>();
string tcNo="13609224456";
var bilgiler = db.bilgilers.First(c => c.tc_kimlik_no ==tcNo);
string adi = bilgiler.adi;
string soyadi = bilgiler.soyadi;
string universite = bilgiler.universite;
engineer e = new engineer(tcNo, adi, soyadi, universite);
return e;
}
我有不止一种方法,我可以无错误地运行 web 服务,但是当我调用该getItem()
方法时,我得到以下异常。我该如何解决这个问题?
[InvalidOperationException: Parametresiz oluşturucusu olmadığından MUHENDIS.Service1.engineer seri hale getirilemez.]
System.Xml.Serialization.TypeDesc.CheckSupported() +3938411
System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError) +170
System.Xml.Serialization.XmlReflectionImporter.ImportMemberMapping(XmlReflectionMember xmlReflectionMember, String ns, XmlReflectionMember[] xmlReflectionMembers, Boolean rpc, Boolean openModel, RecursionLimiter limiter) +65
System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, RecursionLimiter limiter) +236
[InvalidOperationException: 'getItemResult' yansıtmada bir hata oluştu.]
System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, RecursionLimiter limiter) +843
System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, XmlMappingAccess access) +130
System.Web.Services.Protocols.SoapReflector.ImportMembersMapping(XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, Boolean serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use, SoapParameterStyle paramStyle, String elementName, String elementNamespace, Boolean nsIsDefault, XmlReflectionMember[] members, Boolean validate, Boolean openModel, String key, Boolean writeAccess) +223
System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) +2989
编辑:谷歌将异常消息翻译如下:
- MUHENDIS.Service1.engineer 不是无参数的构造函数被序列化。
- 'getItemResult' 以反映发生的错误。