Class TransportSecurityException
Exception thrown when a transport security requirement is not met.
public sealed class TransportSecurityException : InvalidOperationException, ISerializable
- Inheritance
-
TransportSecurityException
- Implements
- Inherited Members
- Extension Methods
Remarks
This exception is thrown before a connection carries any message, when:
- TLS is required but the connection is not secure. FailureReason is TlsNotEnabled.
- A transport's security protocol is configured in two places that disagree, or with a value the transport does not recognize. Refusing beats guessing at a security control, so the connection is never established. FailureReason is Unspecified, because the failure is a configuration contradiction rather than a wire-security posture; the message names the conflicting settings.
Constructors
TransportSecurityException()
Initializes a new instance of the TransportSecurityException class.
public TransportSecurityException()
TransportSecurityException(string)
Initializes a new instance of the TransportSecurityException class with a specified error message.
public TransportSecurityException(string message)
Parameters
messagestringThe message that describes the error.
TransportSecurityException(string, Exception)
Initializes a new instance of the TransportSecurityException class with a specified error message and a reference to the inner exception.
public TransportSecurityException(string message, Exception innerException)
Parameters
messagestringThe message that describes the error.
innerExceptionExceptionThe exception that is the cause of the current exception.
Properties
FailureReason
Gets the specific security failure reason, for callers that branch on the failure rather than surface its message.
public TransportSecurityFailureReason FailureReason { get; init; }
Property Value
Remarks
Unspecified is a real outcome and not a missing value: it means the refusal was not a wire-security posture failure. Read Message for those.
TransportName
Gets the transport where the security failure occurred, such as Kafka or RabbitMQ.
public string? TransportName { get; init; }
Property Value
Remarks
This identifies the transport family that refused the connection, not the name a connection was registered under in dependency injection. A host wiring more than one transport uses it to tell which one refused.