l'appli n'arrive pas a accéder au service windows
Bonjour à tous,
Ca fait un moment que j'essaie le .net Remoting couplé a un service windows. Mon application est divisé en composants comme suit:
- L'interface qui est partagé par le client et le serveur
- La DAL qui permet d'avoir acces a la BD mais aussi tranforme les différentes tables en objets et qui implémente l'interface
- Le wsRefBD qui est en fait est le service windows qui doit exposer les objets du serveur.
Ensuite une application client qui a les formulaires etc. qui est censé se connecter a mon service windows
Mes objets sont exposés par tcp avec la méthode wellknown.
Le service est bien installer mais qd je lance l'application cliente, elle attend indéfiniment. Si au moins il y avais une erreur, je pourrais avoir une piste mais la...:aie:
voici le code du service windows
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
'Dim appconfig As String = "wsRefBD.exe.config"
'RemotingConfiguration.Configure(appconfig, True)
EventLog.WriteEntry("RemoteSystemInfo: OnStart -- Entering")
Dim tcpChannel As New Tcp.TcpChannel(1235)
EventLog.WriteEntry("RemoteSystemInfo: OnStart -- Created Channel")
ChannelServices.RegisterChannel(tcpChannel, True)
EventLog.WriteEntry("RemoteSystemInfo:" & " OnStart -- Registered Channel")
RemotingConfiguration.RegisterWellKnownServiceType(GetType(clsUnites), "clsUnites.rem", WellKnownObjectMode.Singleton)
'RemotingConfiguration.RegisterWellKnownServiceType(GetType(clsUnite), "clsUnite.rem", WellKnownObjectMode.Singleton)
EventLog.WriteEntry("RemoteSystemInfo:" & " OnStart -- RegisterWellKnownType Done")
EventLog.WriteEntry("RemoteSystemInfo: OnStart -- Leaving")
End Sub |
le code d'appelle de l'objet liste
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Imports wsRefBD.Interface.Interfaces
Public Class clsUnites
Inherits List(Of clsUnite)
Implements intUnites
Dim ds As New dstRefBD
Dim da As New dstRefBDTableAdapters.tblUniteTableAdapter
Public Function Chargement() As Object Implements [Interface].Interfaces.intUnites.Chargement
Dim lst As New List(Of clsUnite)
da.Fill(ds.tblUnite)
Dim dr As DataRow
For Each dr In ds.tblUnite.Rows
Dim oUnite As New clsUnite
oUnite.NumUnite = dr("NumUnite")
oUnite.CodeUnite = dr("CodeUnite")
oUnite.LibUnite = dr("LibUnite")
lst.Add(oUnite)
Next
Return lst
End Function
End Class |
le code d'appel client
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Imports wsRefBD.Interface.Interfaces
Imports appTest.RefBD.appConstantes
Public Class clsUnites
Inherits List(Of clsUnite)
Implements intUnites
Private Shared lst As List(Of clsUnite)
Private Const objDistant As String = "clsUnites.rem"
Public Function Chargement() As Object Implements intUnites.Chargement
Dim tp_iUnites As intUnites
'Dim lst As List(Of clsUnite)
tp_iUnites = CType(Activator.GetObject(GetType(intUnite), AppConstants.cns & objDistant), intUnites)
lst = tp_iUnites.Chargement()
tp_iUnites = Nothing
Return Nothing
End Function
End Class |
Y a t'il une erreur quelque part?
Je compte sur vous
:oops: