Bonjour j'ai un problème de sérialisation XML de mon datacontract, quand j'essaie de transmettre un objet de type
IndexationContract.IndexationData
Code C# : 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118 using System; using System.Collections.Generic; using System.Runtime.Serialization; namespace IndexationContract { [DataContract] public class IndexationData { /// <summary> /// Titre du document /// </summary> [DataMember] public string Title { get; set; } /// <summary> /// Miniature du fichier /// </summary> [DataMember] public string Thumbnail { get; set; } /// <summary> /// Contenu du document /// </summary> [DataMember] public string Text { get; set; } /// <summary> /// Description du document /// </summary> [DataMember] public string Description { get; set; } /// <summary> /// Taille du document /// </summary> [DataMember] public float Size { get; set; } /// <summary> /// Url/Path du document /// </summary> [DataMember] public string Path { get; set; } /// <summary> /// Langue du document /// </summary> [DataMember] public string Language { get; set; } /// <summary> /// Date de la dernire modification du document /// </summary> [DataMember] public DateTime LastModified { get; set; } /// <summary> /// Date de cration du document /// Utiliser que pour les indexations de documents /// ne provenant pas du net /// </summary> [DataMember] public DateTime CreationDate { get; set; } /// <summary> /// Date du dernier accs au document /// </summary> [DataMember] public DateTime LastAccess { get; set; } /// <summary> /// Type mime du document /// </summary> [DataMember] public string ContentType { get; set; } /// <summary> /// Dfinit si le document provient d'un autre emplacement que le web /// false/null => viens du web /// true => autre /// </summary> [DataMember] public bool IsDesktop { get; set; } /// <summary> /// Dictionnaire de mta donnes, auteur etc... /// object[] { string, int } /// 1 : token /// 2 : notoken /// </summary> [DataMember] public Dictionary<string, object[]> MetaDatas = new Dictionary<string, object[]>(); /// <summary> /// Action to do /// </summary> /// <remarks> /// 1 Index /// 2 Update /// 3 Delete /// </remarks> [DataMember] public int Action { get; set; } /// <summary> /// Old document Path /// </summary> [DataMember] public string OldPath { get; set; } /// <summary> /// Mots clefs /// </summary> [DataMember] public string KeyWords { get; set; } /// <summary> /// Liste de liens avec leur "ancres" /// </summary> [DataMember] public Dictionary<string, string> LinksAndAnchor = new Dictionary<string, string>(); /// <summary> /// Flux Rss contenus dans le document /// </summary> [DataMember] public List<string> RssFeeds = new List<string>(); /// <summary> /// Laps de temps avant de revenir indexer le document /// </summary> [DataMember] public string RevisitAfter { get; set; } } }
L'exception qui est levé au niveau de mon client est :
J'ai donc modifié mon App.config au niveau de mon application cliente
System.ServiceModel.FaultException: Le module de formatage a généré une exception en tentant de désérialiser le message :
Une erreur s’est produite en tentant de désérialiser le paramètre http://tempuri.org/:data. Le message InnerException était
« Une erreur s’est produite lors de la désérialisation de l’objet de type IndexationContract.IndexationData. Dépassement du
quota maximal pour la longueur du contenu de chaîne (8192) lors de la lecture de données XML. Ce quota peut être augmenté
en modifiant la propriété MaxStringContentLength sur l’objet XmlDictionaryReaderQuotas utilisé pendant la création du lecteur XML. ».
Pour plus d’informations, voir InnerException.
Server stack trace:
à System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
à System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
à System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
à System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
à System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Code XML : 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 <configuration> <system.serviceModel> <client> <endpoint name="Tcpclient" contract="IRemoteOperations.IRemoteIndexation" binding="netTcpBinding" address="net.tcp://192.168.1.3:1304" /> </client> <bindings> <netTcpBinding> <binding name="Tcpclient" receiveTimeout="00:00:40" sendTimeout="00:00:3"> <readerQuotas maxStringContentLength="819200" maxDepth="600" maxArrayLength="819200" maxBytesPerRead="819200"/> </binding> </netTcpBinding> </bindings> </system.serviceModel> </configuration>
Au niveau de mon serveur j'ai fais cela :
Code XML : 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 <system.serviceModel> <services> <service name="QueryServer.Tcpservice"> <endpoint contract="IRemoteOperations.IRemoteIndexation" binding="netTcpBinding" address="net.tcp://192.168.1.3:1304" /> </service> </services> <bindings> <netTcpBinding> <binding name="QueryServer.Tcpservice" receiveTimeout="00:00:40" sendTimeout="00:00:3" maxConnections="2000"> <readerQuotas maxStringContentLength="819200" maxDepth="600" maxArrayLength="819200" maxBytesPerRead="819200"/> </binding> </netTcpBinding> </bindings> </system.serviceModel>
Je ne trouve pas ce qui cloche !!
Merci de votre aide
Partager