Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2694 connectés 

  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  [WCF] Comment passer un objet en paramètre ?

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[WCF] Comment passer un objet en paramètre ?

n°1963684
cvb
Posté le 07-02-2010 à 10:44:45  profilanswer
 

Re,
 
Je suis toujours sur la même erreur que hier.Aprés plusieurs recherches et méthode, je pense me rapprocher du but. Sauriez-vous comment je pourrais passé une DataContext entre mon client et une classe implémentant une interface ?
 
Je rapel que je suis en WCF.
 
 

The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.


 
Code Client: Mon erreur se produit à cette ligne là ==> myService.Init(oDataContext).
 

Code :
  1. InitializeComponent();
  2.             myChannelFactory = new ChannelFactory<I_Base_De_Donnees.IServiceDev>(new NetTcpBinding(), "net.tcp://localhost:8018/Interface_Imp_BDD.CurrencyService" );
  3.             myService = myChannelFactory.CreateChannel();
  4.             String Connect = "Server=" + SQLServer_Server + ";Database=" + SQLServer_Database + ";Trusted_Connection=" + SQLServer_TrustedConnection + "; User Id=" + SQLServer_UserId + "; Password=" + SQLServer_UserPassword + "";
  5.             oDataContext = new DataContext(Connect);
  6.             myService.Init(oDataContext);


 
 
Implémentation :
 
       

Code :
  1. public void Init(DataContext Context)
  2. {
  3. (...)
  4. }


 
Interface :
 

Code :
  1. [OperationContract()]
  2.         void Init(DataContext Context);


 
 
 
Auriez-vous une idée de mon erreur ? Je précise que les paramètres de connexion sont bons, puisque je les ai testé sur un autre projet, sans interface, sans rien du tout...
 
D'avance merci
++


Message édité par cvb le 07-02-2010 à 17:27:59
mood
Publicité
Posté le 07-02-2010 à 10:44:45  profilanswer
 

n°1963712
cvb
Posté le 07-02-2010 à 16:30:42  profilanswer
 

Re,
 
Aprés plusieurs rercherche ça serait un problème de sécurité ! Je n'arrive pas à passer cet objet en paramètre !!  [:athlonmp]  
Mais je n'arrive pas à trouvé la configuration necessaire qui irait bien dans mon cas.  
 
Auriez-vous une idée ?
 
[B]App.Config Client :[/B]
 

Code :
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <configuration>
  3.   <system.serviceModel>
  4.     <bindings>
  5.       <netTcpBinding>
  6.         <binding name="NewBinding0">
  7.           <security mode="Transport">
  8.             <transport clientCredentialType="Windows" />
  9.           </security>
  10.         </binding>
  11.       </netTcpBinding>
  12.     </bindings> 
  13.     <client>
  14.       <endpoint
  15.         address="net.tcp://localhost:8018/Interface_Imp_BDD.CurrencyService"
  16.         binding="netTcpBinding"
  17.         contract="I_Base_De_Donnees.IServiceDev"
  18.         name="ConfigurationHttpCurrency" />
  19.     </client> 
  20.   </system.serviceModel>
  21. </configuration>


 
 
[B]App.Config Serveur Hôte:[/B]
 
 

Code :
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <configuration>
  3.   <system.serviceModel>
  4.     <bindings>
  5.       <netTcpBinding>
  6.         <binding name="NewBinding0">
  7.           <security mode="Transport">
  8.             <transport clientCredentialType="Windows" />
  9.           </security>
  10.         </binding>
  11.       </netTcpBinding>
  12.     </bindings> 
  13.     <services>
  14.       <service name="Interface_Imp_BDD.CurrencyService">
  15.         <endpoint
  16.             address="net.tcp://localhost:8018/Interface_Imp_BDD.CurrencyService"
  17.             binding="netTcpBinding"
  18.             contract="I_Base_De_Donnees.IServiceDev" />
  19.       </service>
  20.     </services>
  21.     <behaviors>
  22.       <serviceBehaviors>
  23.          <behavior name="metadataAndDebug">
  24.             <serviceMetadata  httpGetEnabled="true" httpGetUrl=""/>
  25.             <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
  26.         </behavior>
  27.        </serviceBehaviors>     
  28.     </behaviors>
  29.   </system.serviceModel>
  30.   <system.diagnostics>
  31.     <trace autoflush="true" />
  32.     <sources>
  33.       <source name="System.ServiceModel"
  34.               switchValue="Information, ActivityTracing"
  35.               propagateActivity="true">
  36.         <listeners>
  37.           <add name="sdt"
  38.               type="System.Diagnostics.XmlWriterTraceListener"
  39.               initializeData= "SdrConfigExample.e2e" />
  40.         </listeners>
  41.       </source>
  42.     </sources>
  43.   </system.diagnostics>
  44. </configuration>


 
[B]Interface :[/B]
 

Code :
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.ServiceModel;
  6. using System.Data;
  7. using System.Data.Linq;
  8. using System.ComponentModel;
  9. using System.Net.Security;
  10. namespace I_Base_De_Donnees
  11. {
  12.        
  13.     [ServiceContract(
  14.         Namespace="http://microsoft.wcf.documentation",
  15.         Name="SampleService",
  16.         ProtectionLevel=ProtectionLevel.EncryptAndSign)]
  17.     public interface IServiceDev
  18.     {
  19.         [OperationContract()]
  20.         void Init(DataContext Context);
  21.     }
  22. }


Message édité par cvb le 07-02-2010 à 17:20:25

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  [WCF] Comment passer un objet en paramètre ?

 

Sujets relatifs
Access ouverture d'un état paramétré avec variable VBAImpact du FrameWork utilisé pour le client d'un Service WCF
Se passer de javascript sur son sitesoucis pour centrer un objet flash dans un form (css)
Appel d'objet dynamiquementVue multiple MFC et objet Quicktime
Placement objet myspace et compatibilitépasser de Frontpage à ... un autre logi ???
Débutant intégral cherche langage orienté objet[VBA]- passer la ligne en dessous
Plus de sujets relatifs à : [WCF] Comment passer un objet en paramètre ?


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR