Bonjour,
J'ai un client WPF qui utilise un service WCF afin d'obtenir une Liste d'objets.
Cette Liste d'objets est obtenue à partir de mon Server SQL via l'Entity Framework. Elle se compose de 3 éléments de petites tailles.
Le problème est le suivant :
Client :The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:29:58.9370000'.
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 using System; using System.Collections.Generic; using System.ServiceModel; using ComInterface; using DAL; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { List<Sondage> _sondages; using (ChannelFactory<IEnregistrement> channelFactory = new ChannelFactory<IEnregistrement>("Enregistrement")) { IEnregistrement proxyEnregistrement = channelFactory.CreateChannel(); _sondages = proxyEnregistrement.GetSondages(); foreach (Sondage s in _sondages) { Console.WriteLine(s.Nom); } channelFactory.Close(); } Console.ReadLine(); } } }
Client - App.Config
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
19
20
21
22
23
24
25
26
27
28 <?xml version="1.0"?> <configuration> <system.serviceModel> <bindings> <netTcpBinding> <binding name="NetTcpBindingConfig" openTimeout="00:01:00" sendTimeout="00:30:00" closeTimeout="00:30:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <security> <transport/> </security> </binding> </netTcpBinding> </bindings> <client> <endpoint contract="ComInterface.IEnregistrement" binding="netTcpBinding" bindingConfiguration="NetTcpBindingConfig" behaviorConfiguration="customQuotaBehaviour" address="net.tcp://localhost:5555/Enregistrement" name="Enregistrement"/> </client> <behaviors> <endpointBehaviors> <behavior name="customQuotaBehaviour"> <dataContractSerializer maxItemsInObjectGraph="2147483646"/> </behavior> </endpointBehaviors> </behaviors> </system.serviceModel> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> </configuration>
Serveur :
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 using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.Text; using ComInterface; using System.Collections.ObjectModel; using DAL; namespace ServeurEnregistrement { public class Enregistrement : IEnregistrement { public List<Sondage> GetSondages() { using (var ctx = new dbEntities()) { var sondages = from s in ctx.Sondages select s; return sondages.ToList(); } } } }
Serveur - App.config
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
19
20
21
22
23 <?xml version="1.0"?> <configuration> <system.serviceModel> <bindings> <netTcpBinding> <binding name="NetTcpBindingConfig" openTimeout="00:01:00" sendTimeout="00:30:00" closeTimeout="00:30:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <security> <transport/> </security> </binding> </netTcpBinding> </bindings> <services> <service name="ServeurEnregistrement.Enregistrement"> <endpoint contract="ComInterface.IEnregistrement" binding="netTcpBinding" bindingConfiguration="NetTcpBindingConfig" address="net.tcp://localhost:5555/Enregistrement"/> </service> </services> </system.serviceModel> <connectionStrings> <add name="dbEntities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string="Data Source=STEVEN-PC\SQLEXPRESS;Initial Catalog=db_sysrep;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" /> </connectionStrings> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
J'ai essayé de modifier le open/send/close timeout, les buffers et j'ai toujours l'erreur !
Si la méthode : GetSondages return un INT, cela fonctionne... Mais dès que c'est une liste, une observableCollection j'ai l'erreur Communication.
Merci de votre aide,
S
Partager