views:

86

answers:

1

This is my service contract:

<ServiceContract> _
<ServiceKnownType(GetType(String))> _
Public Interface ISecurityMasterChanged

<OperationContract(IsOneWay:=True, Action:="*")> _
Sub ValidateCusipInMessage(ByVal message As MsmqMessage(Of String))

End Interface

This is my class

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

When I try to open the port with this code I get an error

    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 occurred Message="The operation 'ValidateCusipInMessage' on contract 'ISecurityMasterChanged' is configured with TransactionAutoComplete set to true and with TransactionScopeRequired set to false. TransactionAutoComplete requires that TransactionScopeRequired is set to true." Source="System.ServiceModel"

This doesn't make sense to me because, as you can see, TransactionAutoComplete is not set to true.

A: 

The default for TransactionAutoComplete is true. Which makes me wonder if you have to decorate your contract with this attribute instead of your class?

mattRo55