protected override Exception OnSizeQuotaExceeded(int size) { Exception result = new InvalidDataException(string.Format(SRServiceModel.FramingContentTypeTooLong, size)); FramingEncodingString.AddFaultString(result, FramingEncodingString.ContentTypeTooLongFault); return(result); }
protected Exception CreateException(InvalidDataException innerException, string framingFault) { Exception result = CreateException(innerException); FramingEncodingString.AddFaultString(result, framingFault); return(result); }
protected override Exception OnSizeQuotaExceeded(int size) { Exception exception = new InvalidDataException(System.ServiceModel.SR.GetString("FramingContentTypeTooLong", new object[] { size })); FramingEncodingString.AddFaultString(exception, "http://schemas.microsoft.com/ws/2006/05/framing/faults/ContentTypeTooLong"); return(exception); }
protected Exception CreateException(InvalidDataException innerException, string framingFault) { Exception exception = this.CreateException(innerException); FramingEncodingString.AddFaultString(exception, framingFault); return(exception); }
protected override Exception OnSizeQuotaExceeded(int size) { Exception result = new InvalidDataException(SR.Format(SR.FramingViaTooLong, size)); FramingEncodingString.AddFaultString(result, FramingEncodingString.ViaTooLongFault); return(result); }
void OnConnectionModeKnownCore(ConnectionModeReader modeReader, bool isCached) { lock (ThisLock) { if (isDisposed) { return; } this.connectionReaders.Remove(modeReader); } bool closeReader = true; try { FramingMode framingMode; try { framingMode = modeReader.GetConnectionMode(); } catch (CommunicationException exception) { TraceEventType eventType = modeReader.Connection.ExceptionEventType; DiagnosticUtility.TraceHandledException(exception, eventType); return; } catch (TimeoutException exception) { if (!isCached) { exception = new TimeoutException(SR.GetString(SR.ChannelInitializationTimeout, this.channelInitializationTimeout), exception); System.ServiceModel.Dispatcher.ErrorBehavior.ThrowAndCatch(exception); } if (TD.ChannelInitializationTimeoutIsEnabled()) { TD.ChannelInitializationTimeout(SR.GetString(SR.ChannelInitializationTimeout, this.channelInitializationTimeout)); } TraceEventType eventType = modeReader.Connection.ExceptionEventType; DiagnosticUtility.TraceHandledException(exception, eventType); return; } switch (framingMode) { case FramingMode.Duplex: OnDuplexConnection(modeReader.Connection, modeReader.ConnectionDequeuedCallback, modeReader.StreamPosition, modeReader.BufferOffset, modeReader.BufferSize, modeReader.GetRemainingTimeout()); break; case FramingMode.Singleton: OnSingletonConnection(modeReader.Connection, modeReader.ConnectionDequeuedCallback, modeReader.StreamPosition, modeReader.BufferOffset, modeReader.BufferSize, modeReader.GetRemainingTimeout()); break; default: { Exception inner = new InvalidDataException(SR.GetString( SR.FramingModeNotSupported, framingMode)); Exception exception = new ProtocolException(inner.Message, inner); FramingEncodingString.AddFaultString(exception, FramingEncodingString.UnsupportedModeFault); System.ServiceModel.Dispatcher.ErrorBehavior.ThrowAndCatch(exception); return; } } closeReader = false; } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } if (!ExceptionHandler.HandleTransportExceptionHelper(e)) { throw; } // containment -- the reader is aborted, no need for additional containment } finally { if (closeReader) { modeReader.Dispose(); } } }
private void OnConnectionModeKnownCore(ConnectionModeReader modeReader, bool isCached) { lock (this.ThisLock) { if (this.isDisposed) { return; } this.connectionReaders.Remove(modeReader); } bool flag = true; try { FramingMode connectionMode; try { connectionMode = modeReader.GetConnectionMode(); } catch (CommunicationException exception) { TraceEventType exceptionEventType = modeReader.Connection.ExceptionEventType; if (DiagnosticUtility.ShouldTrace(exceptionEventType)) { DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, exceptionEventType); } return; } catch (TimeoutException exception2) { if (!isCached) { exception2 = new TimeoutException(System.ServiceModel.SR.GetString("ChannelInitializationTimeout", new object[] { this.channelInitializationTimeout }), exception2); ErrorBehavior.ThrowAndCatch(exception2); } TraceEventType type = modeReader.Connection.ExceptionEventType; if (DiagnosticUtility.ShouldTrace(type)) { DiagnosticUtility.ExceptionUtility.TraceHandledException(exception2, type); } return; } switch (connectionMode) { case FramingMode.Singleton: this.OnSingletonConnection(modeReader.Connection, modeReader.ConnectionDequeuedCallback, modeReader.StreamPosition, modeReader.BufferOffset, modeReader.BufferSize, modeReader.GetRemainingTimeout()); break; case FramingMode.Duplex: this.OnDuplexConnection(modeReader.Connection, modeReader.ConnectionDequeuedCallback, modeReader.StreamPosition, modeReader.BufferOffset, modeReader.BufferSize, modeReader.GetRemainingTimeout()); break; default: { Exception innerException = new InvalidDataException(System.ServiceModel.SR.GetString("FramingModeNotSupported", new object[] { connectionMode })); Exception exception4 = new ProtocolException(innerException.Message, innerException); FramingEncodingString.AddFaultString(exception4, "http://schemas.microsoft.com/ws/2006/05/framing/faults/UnsupportedMode"); ErrorBehavior.ThrowAndCatch(exception4); return; } } flag = false; } catch (Exception exception5) { if (Fx.IsFatal(exception5)) { throw; } if (!System.ServiceModel.Dispatcher.ExceptionHandler.HandleTransportExceptionHelper(exception5)) { throw; } } finally { if (flag) { modeReader.Dispose(); } } }