Share via


ChannelDispatcher.TransactionTimeout 속성

정의

서비스 대신 디스패처에서 만든 새 트랜잭션의 기본 제한 시간을 지정하는 값을 가져오거나 설정합니다.

public:
 property TimeSpan TransactionTimeout { TimeSpan get(); void set(TimeSpan value); };
public TimeSpan TransactionTimeout { get; set; }
member this.TransactionTimeout : TimeSpan with get, set
Public Property TransactionTimeout As TimeSpan

속성 값

트랜잭션의 기본 제한 시간 기간을 나타내는 TimeSpan 값입니다. 기본값은 Zero입니다.

예외

값이 0보다 작거나 너무 큰 경우

통신 개체가 Opening 또는 Opened 상태에 있는 경우

통신 개체가 Closing 또는 Closed 상태에 있는 경우

통신 개체가 Faulted 상태에 있는 경우

예제

Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

serviceHost.AddServiceEndpoint(
    typeof(ICalculator),
    new WSHttpBinding(),
    "CalculatorServiceObject");

serviceHost.Open();

IChannelListener icl = serviceHost.ChannelDispatchers[0].Listener;
ChannelDispatcher dispatcher = new ChannelDispatcher(icl);
dispatcher.TransactionTimeout = new TimeSpan(100);
Dim baseAddress As New Uri("http://localhost:8001/Simple")
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)

serviceHost.AddServiceEndpoint(GetType(ICalculator), New WSHttpBinding(), "CalculatorServiceObject")

serviceHost.Open()

Dim icl As IChannelListener = serviceHost.ChannelDispatchers(0).Listener
Dim dispatcher As New ChannelDispatcher(icl)
dispatcher.TransactionTimeout = New TimeSpan(100)

설명

이 속성은 ChannelDispatcher의 인스턴스가 Created 상태에 있는 경우에만 설정할 수 있는데 그 이유는 이 상태가 변경 가능하면서 삭제되지 않은 유일한 상태이기 때문입니다.

적용 대상