Bonjour, j'ai une erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
Détails de l'exception: System.NotSupportedException: Impossible de sérialiser le membre System.ComponentModel.MarshalByValueComponent.Site de type System.ComponentModel.ISite car il s'agit d'une interface.
Je vous explique, j'ai un schéma xsd, j'ai crée un fichier cs via l'outil "xsd.exe".
Et mon webservice utilise des objets de cs dont forcément sérialisable.
Ma xsd est super longue, donc le cs généré aussi...
La trace de ma pile :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
[NotSupportedException: Impossible de sérialiser le membre System.ComponentModel.MarshalByValueComponent.Site de type System.ComponentModel.ISite car il s'agit d'une interface.]
 
[InvalidOperationException: Impossible de sérialiser le membre 'System.ComponentModel.MarshalByValueComponent.Site' de type 'System.ComponentModel.ISite'. Pour plus de détails, consultez l'exception interne.]
   System.Xml.Serialization.StructModel.CheckSupportedMember(TypeDesc typeDesc, MemberInfo member, Type type) +925156
   System.Xml.Serialization.StructModel.GetPropertyModel(PropertyInfo propertyInfo) +127
   System.Xml.Serialization.StructModel.GetFieldModel(MemberInfo memberInfo) +118
   System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a) +1824
   System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a) +848
   System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a) +848
   System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel) +734
 
[InvalidOperationException: Une erreur s'est produite lors de la réflexion du type 'fr.XXXXX.outilauteur.Exercice'.]
   System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel) +1638
   System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, String ns, Type choiceIdentifierType, Boolean rpc, Boolean openModel) +9747
   System.Xml.Serialization.XmlReflectionImporter.ImportMemberMapping(XmlReflectionMember xmlReflectionMember, String ns, XmlReflectionMember[] xmlReflectionMembers, Boolean rpc, Boolean openModel) +953
   System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel) +278
 
[InvalidOperationException: Erreur reflétant 'getExerciceResult'.]
   System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel) +877
   System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, XmlMappingAccess access) +111
   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) +203
   System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) +3596
 
[InvalidOperationException: La méthode Exercice.getExercice ne peut pas être réfléchie.]
   System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) +6904
   System.Web.Services.Description.SoapProtocolReflector.ReflectMethod() +133
   System.Web.Services.Description.ProtocolReflector.ReflectBinding(ReflectedBinding reflectedBinding) +2760
   System.Web.Services.Description.ProtocolReflector.Reflect() +739
   System.Web.Services.Description.ServiceDescriptionReflector.ReflectInternal(ProtocolReflector[] reflectors) +621
   System.Web.Services.Description.ServiceDescriptionReflector.Reflect(Type type, String url) +117
   System.Web.Services.Protocols.DocumentationServerType..ctor(Type type, String uri) +157
   System.Web.Services.Protocols.DocumentationServerProtocol.Initialize() +336
   System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) +105
 
[InvalidOperationException: Impossible de gérer la demande.]
   System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) +295
   System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +202
 
[InvalidOperationException: Impossible de gérer la demande.]
   System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +363
   System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +211
   System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +175
   System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +128
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +161
JE sais que ce n'est pas tres explicite, mais auriez vous déjà eu ce type .
d'erreur.
Ci-dessous ma webmethod qui plante.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
 [WebMethod]
        public Exercice getExercice(int  ExerciceId, int CandidateId)
        {
            Exercice exercice;
            exercice = new Exercice();
   return exercice;
        }
J'ai vu que l'on peut faire
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
exercice.GetService(typeof(????));
Je ne sais que mettre. C'est peut etre cela l'origine de mon probleme.
Ou m'indiquer des pistes de recherches, car je suis vraiment perdu...