0
這是我的服務合同:如何將MsmqIntegrationBinding與非事務性隊列一起使用?
<ServiceContract> _
<ServiceKnownType(GetType(String))> _
Public Interface ISecurityMasterChanged
<OperationContract(IsOneWay:=True, Action:="*")> _
Sub ValidateCusipInMessage(ByVal message As MsmqMessage(Of String))
End Interface
這是我的課
Public Class SecurityValidator
Implements ISecurityMasterChanged
<OperationBehavior(TransactionAutoComplete:=False, TransactionScopeRequired:=False)> _
<ServiceKnownType(GetType(String))> _
Public Sub ValidateCusipInMessage(ByVal message As MsmqIntegration.MsmqMessage(Of String)) Implements ISecurityMasterChanged.ValidateCusipInMessage
'...
End Sub
當我嘗試打開端口與此代碼我得到一個錯誤
m_ServiceHostQueue = New ServiceHost(Me)
m_ServiceHostQueue.AddServiceEndpoint(GetType(ISecurityMasterChanged), New MsmqIntegrationBinding With {.ExactlyOnce = False}, m_Config("SMChanged Queue").ToString)
m_ServiceHostQueue.Open()
System.InvalidOperationException發生了 Message =「合同'ISecurityMasterChanged'上的操作'ValidateCusipInMessage'使用TransactionAutoCo將完整設置爲true,並將TransactionScopeRequired設置爲false。 TransactionAutoComplete要求TransactionScopeRequired設置爲true。」 來源=‘System.ServiceModel’
這沒有意義,我,因爲你可以看到,TransactionAutoComplete沒有被設置爲true。
不,這不是合同級別的屬性,它在實現中被正確指定。 – 2014-06-30 09:55:09