Dobry den, Mam windows service a GUI aplikaciu a potrebujem aby medzi sebou komunikovali. Na strane servicu otvorim Ipc channel pomocou nasledovneho kodu
Dim ipcCh As IpcChannel
ipcCh = New IpcChannel("bls-pwiz-channel")
ipcCh.IsSecured = False
ChannelServices.RegisterChannel(ipcCh, False)
RemotingConfiguration.RegisterWellKnownServiceType(GetType(CommunicationService), "bls-pwiz", WellKnownObjectMode.Singleton)
Na strane GUI sa potom snazim dostat zo service informacie nejako takto
Dim ipcCh As New IpcChannel("myClient")
ChannelServices.RegisterChannel(ipcCh, False)
Dim obj As SharedInterfaces.CommFace
obj = DirectCast(Activator.GetObject(GetType(SharedInterfaces.CommFace), "ipc://bls-pwiz-channel/bls-pwiz"), SharedInterfaces.CommFace)
Dim var As DataTable = obj.ReturnProcessDataTable
ProcessGrid.DataSource = var
ChannelServices.UnregisterChannel(ipcCh)
ReturnProcessDataTable je funkcia, ktoru mam zadefinovanu inde. Ak som obidve aplikacie spustil ako bezne aplikacie [nie service], vsetko fungovalo ako malo. Ak vsak spustim service ako service, dostavam nasledovnu vynimku "Failed to connect to an IPC Port: Access is denied." Vedel by mi niekto poradit ako nastavit IpcChannel, aby k tejto vynimke nedochadzalo ? ...pripadne nejaky iny sposob ako komunikovat Service <=> GUI. Za odpoved vopred dakujem
|