Dear all,
I have an application (VB.Net 2.0) with a client and a remoteing server.
Once the clients starts his work, he registers with the server and receives a session-ID. The session data is stored on the server and the client receives the session id.
Once registered, the client stores the session id in the
CallContext
using "
SetData()
".
Everything works fine until the session id gets lost (e.g. due to a server restart).
The client checks for a valid session id and if his id is not valid, he requests a new id. so far: everything fine.
Now the client updates
CallContext
with the new session id, but this step does only work for the client. the server still receives the old
ID
when called and runs in errors as he considers the client "not registered".
I tried
-
CallContext.GetData/SetData
-
CallContext.LogicalGetData/SetData
-
trying to delete the old data with CallContext.FreeNamedDataslot.
without success.
Edit:
Here is the piece of code on the client side.
I have translated the comments
Public Shared Sub RegisterClient()
Dim obCC As ClientContext = ClientContext.GetInstance
Dim cltToken As ClientToken
Try
Trace.WriteLineIf(m_TraceSwitch.Enabled, ">> Register Client")
Trace.Indent()
InitialisierungsBildschirm.SetzeSchritt("Client registrieren.")
obCC.InitializeClient(AktuellerBenutzer.UserLoginName, My.Computer.Name)
obCC.RegisterClientAtSessionManager()
CallContext.LogicalSetData("ClientId", obCC.GetClientToken)
Catch ex As Exception
Throw
Finally
Trace.Unindent()
Trace.WriteLineIf(m_TraceSwitch.Enabled, "<< Register Client")
End Try
End Sub
And this shows how the server tries to retrieve the context setting:
Public Function GetClientSettings() As ClientSettings
Dim m_SessionManager As ISessionManager
Dim m_ClientToken As ClientToken
m_ClientToken = CType(CallContext.LogicalGetData("ClientId"), ClientToken)
If m_ClientToken Is Nothing Then
Return Nothing
End If
If m_ClientToken.ClientID <> String.Empty Then
Try
m_SessionManager = GetSessionManager()
Catch
Throw
End Try
Return m_SessionManager.GetClientSettings(m_ClientToken.ClientID)
Else
Return Nothing
End If
End Function
I deleted some exception handling.
No exceptions occur during runtime on either side.
Any idea how to solve this problem would be greatly appreciated.
Thomas