Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Description / ServiceDebugBehavior.cs / 2 / ServiceDebugBehavior.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Description
{
using System.IO;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Activation;
using System.ServiceModel.Channels;
using System.Xml;
using WsdlNS = System.Web.Services.Description;
using XsdNS = System.Xml.Schema;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Xml.Schema;
using System.ServiceModel.Configuration;
using System.Collections;
using System.ServiceModel.Diagnostics;
using System.Diagnostics;
public class ServiceDebugBehavior : IServiceBehavior
{
bool includeExceptionDetailInFaults = false;
bool httpHelpPageEnabled = true;
Uri httpHelpPageUrl;
bool httpsHelpPageEnabled = true;
Uri httpsHelpPageUrl;
Binding httpHelpPageBinding;
Binding httpsHelpPageBinding;
public bool HttpHelpPageEnabled
{
get { return this.httpHelpPageEnabled; }
set { this.httpHelpPageEnabled = value; }
}
public Uri HttpHelpPageUrl
{
get { return this.httpHelpPageUrl; }
set
{
if (value != null && value.IsAbsoluteUri && value.Scheme != Uri.UriSchemeHttp)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.SFxServiceMetadataBehaviorUrlMustBeHttpOrRelative,
"HttpHelpPageUrl", Uri.UriSchemeHttp, value.ToString(), value.Scheme));
}
this.httpHelpPageUrl = value;
}
}
public bool HttpsHelpPageEnabled
{
get { return this.httpsHelpPageEnabled; }
set { this.httpsHelpPageEnabled = value; }
}
public Uri HttpsHelpPageUrl
{
get { return this.httpsHelpPageUrl; }
set
{
if (value != null && value.IsAbsoluteUri && value.Scheme != Uri.UriSchemeHttps)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.SFxServiceMetadataBehaviorUrlMustBeHttpOrRelative,
"HttpsHelpPageUrl", Uri.UriSchemeHttps, value.ToString(), value.Scheme));
}
this.httpsHelpPageUrl = value;
}
}
public Binding HttpHelpPageBinding
{
get { return this.httpHelpPageBinding; }
set
{
if (value != null)
{
if (!value.Scheme.Equals(Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.SFxBindingSchemeDoesNotMatch,
value.Scheme, value.GetType().ToString(), Uri.UriSchemeHttp));
}
CustomBinding customBinding = new CustomBinding(value);
TextMessageEncodingBindingElement textMessageEncodingBindingElement = customBinding.Elements.Find();
if (textMessageEncodingBindingElement != null && !textMessageEncodingBindingElement.MessageVersion.IsMatch(MessageVersion.None))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.SFxIncorrectMessageVersion,
textMessageEncodingBindingElement.MessageVersion.ToString(), MessageVersion.None.ToString()));
}
HttpTransportBindingElement httpTransportBindingElement = customBinding.Elements.Find();
if (httpTransportBindingElement != null)
{
httpTransportBindingElement.Method = "GET";
}
this.httpHelpPageBinding = customBinding;
}
}
}
public Binding HttpsHelpPageBinding
{
get { return this.httpsHelpPageBinding; }
set
{
if (value != null)
{
if (!value.Scheme.Equals(Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.SFxBindingSchemeDoesNotMatch,
value.Scheme, value.GetType().ToString(), Uri.UriSchemeHttps));
}
CustomBinding customBinding = new CustomBinding(value);
TextMessageEncodingBindingElement textMessageEncodingBindingElement = customBinding.Elements.Find();
if (textMessageEncodingBindingElement != null && !textMessageEncodingBindingElement.MessageVersion.IsMatch(MessageVersion.None))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.SFxIncorrectMessageVersion,
textMessageEncodingBindingElement.MessageVersion.ToString(), MessageVersion.None.ToString()));
}
HttpsTransportBindingElement httpsTransportBindingElement = customBinding.Elements.Find();
if (httpsTransportBindingElement != null)
{
httpsTransportBindingElement.Method = "GET";
}
this.httpsHelpPageBinding = customBinding;
}
}
}
public bool IncludeExceptionDetailInFaults
{
get { return this.includeExceptionDetailInFaults; }
set { this.includeExceptionDetailInFaults = value; }
}
void IServiceBehavior.Validate(ServiceDescription description, ServiceHostBase serviceHostBase)
{
}
void IServiceBehavior.AddBindingParameters(ServiceDescription description, ServiceHostBase serviceHostBase, Collection endpoints, BindingParameterCollection parameters)
{
}
void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase)
{
if (this.includeExceptionDetailInFaults)
{
for (int i=0; i
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DateTimePicker.cs
- WasHostedComPlusFactory.cs
- CreateUserErrorEventArgs.cs
- HMAC.cs
- Literal.cs
- OleDbTransaction.cs
- ZipIOLocalFileBlock.cs
- ReflectionServiceProvider.cs
- HelpKeywordAttribute.cs
- RepeaterCommandEventArgs.cs
- DataGridViewMethods.cs
- ResXResourceWriter.cs
- CodeAttributeArgument.cs
- HebrewCalendar.cs
- MultiByteCodec.cs
- Activity.cs
- ClientUtils.cs
- PageRequestManager.cs
- _OSSOCK.cs
- TextAutomationPeer.cs
- TargetPerspective.cs
- ToolStripSeparatorRenderEventArgs.cs
- DateTime.cs
- ParallelRangeManager.cs
- SettingsSavedEventArgs.cs
- odbcmetadatacollectionnames.cs
- RestClientProxyHandler.cs
- PartialTrustValidationBehavior.cs
- TextBreakpoint.cs
- QueueException.cs
- XmlNodeList.cs
- VoiceSynthesis.cs
- MachineSettingsSection.cs
- webproxy.cs
- ButtonPopupAdapter.cs
- ToolStripSettings.cs
- Types.cs
- _KerberosClient.cs
- GuidConverter.cs
- SecurityChannelFactory.cs
- SafeFindHandle.cs
- DockingAttribute.cs
- PixelShader.cs
- DataGridViewRowPrePaintEventArgs.cs
- OptimalBreakSession.cs
- FacetEnabledSchemaElement.cs
- XPathDocumentNavigator.cs
- SecurityTokenTypes.cs
- SqlRetyper.cs
- AssemblyCache.cs
- HostingEnvironment.cs
- LogFlushAsyncResult.cs
- RewritingProcessor.cs
- ToolStripTextBox.cs
- SHA384Managed.cs
- DataGridComboBoxColumn.cs
- EventlogProvider.cs
- ComponentResourceManager.cs
- DuplicateContext.cs
- BeginGetFileNameFromUserRequest.cs
- SystemColorTracker.cs
- NumberAction.cs
- UserUseLicenseDictionaryLoader.cs
- FontSourceCollection.cs
- DelegateOutArgument.cs
- LoadMessageLogger.cs
- RequestNavigateEventArgs.cs
- BitmapEffectDrawingContextWalker.cs
- Keywords.cs
- DataBoundControl.cs
- SolidColorBrush.cs
- FrameworkContentElement.cs
- ErrorTableItemStyle.cs
- RelationshipDetailsCollection.cs
- CustomErrorsSection.cs
- path.cs
- MiniConstructorInfo.cs
- recordstate.cs
- PolicyStatement.cs
- ExternalCalls.cs
- contentDescriptor.cs
- XPathQilFactory.cs
- Automation.cs
- PathSegment.cs
- XmlProcessingInstruction.cs
- IconBitmapDecoder.cs
- ErrorTableItemStyle.cs
- CodeMemberEvent.cs
- SizeAnimation.cs
- ConfigXmlSignificantWhitespace.cs
- AliasedExpr.cs
- ValidatedControlConverter.cs
- DesignerForm.cs
- METAHEADER.cs
- Region.cs
- ConditionalWeakTable.cs
- XPathNavigator.cs
- ITreeGenerator.cs
- EnumBuilder.cs
- CodeAttributeArgument.cs