HttpListener.IgnoreWriteExceptions 속성

정의

Boolean에서 클라이언트에 응답을 보낼 때 발생하는 예외를 애플리케이션에서 받을지 여부를 지정하는 HttpListener 값을 가져오거나 설정합니다.

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

속성 값

Boolean

true 클라이언트에 응답을 보낼 때 발생하는 예외를 반환하지 않으면 이 HttpListener 고, false그렇지 않으면 . 기본값은 false입니다.

예외

이 개체가 닫힌 경우.

예제

다음 코드 예제에서는이 속성을 설정 하는 방법을 보여 줍니다.

public static void SimpleListenerWithUnsafeAuthentication(string[] prefixes)
{
    // URI prefixes are required,
    // for example "http://contoso.com:8080/index/".
    if (prefixes == null || prefixes.Length == 0)
      throw new ArgumentException("prefixes");
    // Set up a listener.
    HttpListener listener = new HttpListener();
    foreach (string s in prefixes)
    {
        listener.Prefixes.Add(s);
    }
    listener.Start();
    // Specify Negotiate as the authentication scheme.
    listener.AuthenticationSchemes = AuthenticationSchemes.Negotiate;
    // If NTLM is used, we will allow multiple requests on the same
    // connection to use the authentication information of first request.
    // This improves performance but does reduce the security of your
    // application.
    listener.UnsafeConnectionNtlmAuthentication = true;
    // This listener does not want to receive exceptions
    // that occur when sending the response to the client.
    listener.IgnoreWriteExceptions = true;
    Console.WriteLine("Listening...");
    // ... process requests here.

    listener.Close();
}
Public Shared Sub SimpleListenerWithUnsafeAuthentication(ByVal prefixes As String())
    ' URI prefixes are required,
    ' for example "http://contoso.com:8080/index/".
    If prefixes Is Nothing OrElse prefixes.Length = 0 Then Throw New ArgumentException("prefixes")
    ' Set up a listener.
    Dim listener As HttpListener = New HttpListener()

    For Each s As String In prefixes
        listener.Prefixes.Add(s)
    Next

    listener.Start()
    ' Specify Negotiate as the authentication scheme.
    listener.AuthenticationSchemes = AuthenticationSchemes.Negotiate
    ' If NTLM Is used, we will allow multiple requests on the same
    ' connection to use the authentication information of first request.
    ' This improves performance but does reduce the security of your 
    ' application. 
    listener.UnsafeConnectionNtlmAuthentication = True
    ' This listener does Not want to receive exceptions 
    ' that occur when sending the response to the client.
    listener.IgnoreWriteExceptions = True
    Console.WriteLine("Listening...")
    ' ... process requests here.

    listener.Close()
End Sub

설명

이 속성을 설정 true 애플리케이션 경우 각 클라이언트에 성공적으로 응답을 보냈음이 필요 하지 않습니다.

적용 대상