session variable getting changed by a seperate instance!! RRS feed

  • General discussion

  • Hi,

    I have a wcf which is configured as
    ConcurrencyMode:=ConcurrencyMode.Multiple and InstanceContextMode:=InstanceContextMode.PerSession

    I've a variable defined globally which I expect to hold its value throughout the session and it is holding that value.

    I've one instance which initializes this variable and holds its value (say 123)
    I've another instance which initializes this variable and holds its value (say 456)

    However, after the second instance initializes the variable, the value for the first instance (session) becomes 456!! which wasn't expected!!

    Is there anything I am missing here?? 


    Thursday, January 31, 2013 11:29 PM

All replies

  • Hi,

    Please share the code on how you create two separate instances.

    Best Regards.

    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, February 5, 2013 2:41 AM
  • Hi Haixia,

    here is how I connect to wcf

     'connect to wcf service
            Friend Sub WCF_Initialize(ByVal NetTcpAddress As String, ByVal SecureConnection As Boolean)
                    Dim myBinding As NetTcpBinding
                    If SecureConnection Then
                        myBinding = New NetTcpBinding(SecurityMode.Transport, False)
                        myBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows
                        myBinding = New NetTcpBinding(SecurityMode.None, False)
                    End If
                    Dim oChannelFactory As New ChannelFactory(Of CFMasterWCF.ICaseflowWCFService)(myBinding)
                    myBinding.ReceiveTimeout = New TimeSpan(10, 10, 10, 10)
                    myBinding.MaxReceivedMessageSize = 2147483647
                    myBinding.MaxBufferSize = 2147483647
                    myBinding.ReaderQuotas.MaxDepth = 2147483647
                    myBinding.ReaderQuotas.MaxStringContentLength = 2147483647
                    myBinding.ReaderQuotas.MaxArrayLength = 2147483647
                    myBinding.ReaderQuotas.MaxBytesPerRead = 2147483647
                    myBinding.ReaderQuotas.MaxNameTableCharCount = 2147483647
                    oChannelFactory.Endpoint.Address = New EndpointAddress(NetTcpAddress)
                    proxy = oChannelFactory.CreateChannel()
                Catch ex As Exception
                    objBussGlobalClass_Internal.DisplayErrorMsg(ex.Message, ex)
                    proxy = Nothing
                End Try
            End Sub

    Different client use this method (from Bussiness Logic) to connect to single wcf service.


    • Edited by Bhavin_Shah Wednesday, February 6, 2013 5:08 AM
    Wednesday, February 6, 2013 4:49 AM