这是我的场景:我有一个托管在 IIS 中的 wcf 服务。wcf 服务由两个主要类组成:MyWcf 和 MyClass。MyWcf 由所有服务端点组成:
<ServiceContract(SessionMode:=SessionMode.Allowed)> Public Interface IMyWcf
<OperationContract()> Function GetListing As DataTable
End Interface
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession, ConcurrencyMode:=ConcurrencyMode.Multiple)> Public Class MyWcf
Implements IMyWcf
Public Function GetListing As DataTable Implements IMyWcf.GetListing
Return MyClass.GetSomeDataTable
End Function
End Class
MyClass 包含所有共享成员
Friend Class MyClass
Friend Shared Function GetSomeDataTable As DataTable
'some code
End Function
End Class
我要确定的是:通过这种设置,如果两个客户端同时调用 GetListing 函数,它们是使用相同的 GetSomeDataTable 函数实例(因为该函数是共享的)还是两个客户端都结束了获取 GetSomeDataTable 函数的不同/唯一实例(以及 MyClass 中的所有其他共享成员)
提前致谢