Groups | Blog | Home
all groups > dotnet remoting > february 2007 >

dotnet remoting : Failed to connect to an IPC Port: Access is denied.


Ron
2/26/2007 9:19:27 AM
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
Mark Fleming
7/12/2007 2:20:46 PM
I have the exact same problem. Did you ever get past this?
Paul Spark
9/30/2007 5:57:06 PM
Hi there. I have the same problem that you reported way back in Feb - I
can't get IPC working in a Windows Service application.

Did you manage to figure this out?

Thanks
AddThis Social Bookmark Button