I'm receiving the above error in a ASP.Net remoting architecture where
(for now) I am running both the server and client on the same machine.
I've attempted to apply known fixes, and currently have the following
setup:
The "<system.runtime.remoting>" section of my machine.config looks
like this:
<system.runtime.remoting>
<application>
<service>
<wellknown
type="ServiceType, common"
objectUri="ServiceType.soap"
mode="Singleton" />
</service>
<channels>
<channel ref="http client" displayName="http client (delay loaded)"
delayLoadAsClientChannel="true"/>
<channel ref="tcp client" displayName="tcp client (delay loaded)"
delayLoadAsClientChannel="true"/>
<channel ref="http">
<serverProviders>
<provider ref="wsdl" />
<formatter ref="soap" typeFilterLevel="Full" />
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
</application>
<channels>
<channel id="http"
type="System.Runtime.Remoting.Channels.Http.HttpChannel,
System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"/>
<channel id="http client"
type="System.Runtime.Remoting.Channels.Http.HttpClientChannel,
System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"/>
<channel id="http server"
type="System.Runtime.Remoting.Channels.Http.HttpServerChannel,
System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"/>
<channel id="tcp" type="System.Runtime.Remoting.Channels.Tcp.TcpChannel,
System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"/>
<channel id="tcp client"
type="System.Runtime.Remoting.Channels.Tcp.TcpClientChannel,
System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"/>
<channel id="tcp server"
type="System.Runtime.Remoting.Channels.Tcp.TcpServerChannel,
System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"/>
</channels>
<channelSinkProviders>
<clientProviders>
<formatter id="soap"
type="System.Runtime.Remoting.Channels.SoapClientFormatterSinkProvider,
System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
<formatter id="binary"
type="System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider,
System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
</clientProviders>
<serverProviders>
<formatter id="soap"
type="System.Runtime.Remoting.Channels.SoapServerFormatterSinkProvider,
System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
<formatter id="binary"
type="System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider,
System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
<provider id="wsdl"
type="System.Runtime.Remoting.MetadataServices.SdlChannelSinkProvider,
System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"/>
</serverProviders>
</channelSinkProviders>
</system.runtime.remoting>
My Server is a Windows Service called RemoteListner, and the OnStart
looks like:
Protected Overrides Sub OnStart(ByVal args() As String)
Me.AutoLog = False
Me.EventLog.WriteEntry("RemoteListener Service Started.")
Try
If ConfigurationSettings.AppSettings("PortToListen") Is Nothing
Then
Throw New Exception("'PortToListen' is not defined in
configuration file.")
End If
Dim sPort As String =
ConfigurationSettings.AppSettings("PortToListen").Trim()
If Not Me.ValidatePort(sPort) Then
Throw New Exception("Port '" + sPort + "' is not valid.")
End If
Dim nPort As Int32 = Convert.ToInt32(sPort)
Dim chnl As New TcpChannel(nPort)
ChannelServices.RegisterChannel(chnl)
RemotingConfiguration.RegisterWellKnownServiceType( _
GetType(clEGovFactory), "Factory.rem",
WellKnownObjectMode.Singleton)
Me.EventLog.WriteEntry("RemoteListener's Server Started
Successfully.")
Catch ex As Exception
Me.EventLog.WriteEntry("Unable to start Server Program:" +
ex.Message)
End Try
Me.EventLog.WriteEntry("RemoteListener Service is running.")
End Sub
Note that my port is "1234"
My client(an ASP.Net page's load event) looks like this:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim sMessage As String = String.Empty
Dim objProfile As IProfile = Nothing
Dim objAddress As IAddress = Nothing
Try
If Application(clPageBase.m_sExSysTokenAO).ToString() Is Nothing
OrElse _
Application(clPageBase.m_sExSysTokenAO).ToString() = String.Empty
Then
Throw New Exception("Can not find ex sys token in application
object")
End If
Dim sExSysToken As String =
Application(clPageBase.m_sExSysTokenAO).ToString()
objProfile = clPageBase.Factory.GetProfile(sExSysToken)
With objProfile
.FirstName = "Bill"
.LastName = "Cat"
.LoginID = "billCat"
.SecretQuestionID = 1
.SecretAnswer = "Mom"
If Not .SetPassword("Quality1",
Application(clPageBase.m_sExSysTokenAO).ToString(), String.Empty,
sMessage) Then
Throw New Exception("Unable to set password for Bill the Cat: " +
sMessage)
End If
If Not .Save(sMessage) Then
Throw New Exception("Unable to save Bill the Cat: " + sMessage)
End If
Me.txtUnitTest.Text = "Bill The Cat ID: " +
objProfile.ID.ToString()
End With
objAddress = clPageBase.Factory.GetAddress(sExSysToken)
With objAddress
.AddressLine1 = "1111 e"
.City = "Cheyenne"
.State = "WY"
.Zip = "82001"
End With
' The following line crashes!!!!!!!!
If Not objProfile.Addresses.Add(objAddress, sMessage) Then
Throw New Exception("Can not add address: " + sMessage)
End If
Me.txtUnitTest.Text += vbCrLf + "Address count: " +
objProfile.Addresses.Count.ToString()
Catch exc As Exception
Me.txtUnitTest.Text = exc.Message
End Try
End Sub
When I attempt to Add the address object (passing it back to the
server, I guess), I get the above mentioned security exception.
Does anyone see where I'm going wrong? If you need more info, please
ask.
Thanks,