I get the error above when I try to use IPC to connect to a Windows Service.
The same code works fine when it is in a standalone test application. It alos
works when implemented as a TCP channel.
Thanks for any suggestions.
Server Code:
Private Sub RegisterServerChannel()
' Dim chan As IpcChannel
Dim oServChan As IpcServerChannel
Dim oServer As IServerChannelSinkProvider = Nothing
Dim oConfig As CacheConfiguration
Dim prop As IDictionary
Dim oEvent As EventEntry
Try
oConfig = New CacheConfiguration
prop = New Hashtable
prop("name") = "DCNRCache"
prop("portName") = "localhost:9093"
prop("tokenImpersonationLevel") =
TokenImpersonationLevel.Impersonation
prop("includeVersions") = False
prop("strictBinding") = False
prop("secure") = True
prop("exclusiveAddressUse") = False
prop("authorizedGroup") = "testworkstation\CacheAccess"
oServChan = New IpcServerChannel(prop, oServer)
ChannelServices.RegisterChannel(oServChan, True)
RemotingConfiguration.RegisterWellKnownServiceType( _
GetType(CacheManager.CacheControl), _
"CacheManager", _
WellKnownObjectMode.Singleton)
oEvent = New EventEntry
oEvent.Write("IPCServerChannel started ", "Application",
"DCNRService", EventLogEntryType.Information)
oEvent.Write(Thread.CurrentPrincipal.Identity.Name.ToString,
"Application", "DCNRService", EventLogEntryType.Information)
Catch ex As Exception
oEvent = New EventEntry
oEvent.Write(ex.ToString, "Application", "DCNRService",
EventLogEntryType.Error)
End Try
End Sub
Client Code:
Private Function RegisterChannel() As Boolean
Dim oClientChan As IpcClientChannel
Dim oClient As IClientChannelSinkProvider = Nothing
Dim oConfig As CacheConfiguration
Dim prop As IDictionary
oConfig = New CacheConfiguration
prop = New Hashtable
prop("name") = "DCNRCache"
prop("portName") = "localhost:9093"
prop("tokenImpersonationLevel") =
TokenImpersonationLevel.Impersonation
prop("includeVersions") = False
prop("strictBinding") = False
prop("secure") = True
prop("exclusiveAddressUse") = False
prop("authorizedGroup") = "testworkstation\CacheAccess"
oClientChan = New IpcClientChannel(prop, oClient)
ChannelServices.RegisterChannel(oClientChan, True)
Try
obj =
CType(Activator.GetObject(GetType(CacheManager.CacheControl),
"ipc://localhost:9093/CacheManager"), CacheManager.CacheControl)
If obj Is Nothing Then
Throw New Exception("Could not locate server")
Else
If Not obj.Ping Then
Throw New Exception("Could not connect to server")
End If
End If
RegisterChannel = True
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Function