本文整理汇总了C#中HttpsTransportBindingElement类的典型用法代码示例。如果您正苦于以下问题:C# HttpsTransportBindingElement类的具体用法?C# HttpsTransportBindingElement怎么用?C# HttpsTransportBindingElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HttpsTransportBindingElement类属于命名空间,在下文中一共展示了HttpsTransportBindingElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetClient
public static OmnitureWebServicePortTypeClient GetClient( string username, string secret, string endpoint )
{
var httpsTransportBindingElement = new HttpsTransportBindingElement
{
UseDefaultWebProxy = false,
MaxReceivedMessageSize = 2147483647
};
var transportSecurityBindingElement = new TransportSecurityBindingElement();
transportSecurityBindingElement.EndpointSupportingTokenParameters.SignedEncrypted.Add( new SecurityTokenParameters() );
transportSecurityBindingElement.IncludeTimestamp = false;
var customTextMessageBindingElement = new CustomTextMessageBindingElement { MessageVersion = MessageVersion.Soap11 };
var bindingElements = new List<BindingElement>
{
transportSecurityBindingElement,
customTextMessageBindingElement,
httpsTransportBindingElement
};
Binding customBinding = new CustomBinding( bindingElements.ToArray() );
var endpointAddress = new EndpointAddress( endpoint );
var clientCredential = new ClientCredentials( new Info( username, secret ) );
var omnitureWebServicePortTypeClient = new OmnitureWebServicePortTypeClient( customBinding, endpointAddress );
omnitureWebServicePortTypeClient.Endpoint.Behaviors.Remove( typeof( System.ServiceModel.Description.ClientCredentials ) );
omnitureWebServicePortTypeClient.Endpoint.Behaviors.Add( clientCredential );
return omnitureWebServicePortTypeClient;
}
开发者ID:Sn3b,项目名称:Omniture-API,代码行数:31,代码来源:ClientHelper.cs
示例2: TryImportWsspHttpsTokenAssertion
public override bool TryImportWsspHttpsTokenAssertion(MetadataImporter importer, ICollection<XmlElement> assertions, HttpsTransportBindingElement httpsBinding)
{
XmlElement element;
if (assertions == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("assertions");
}
if (this.TryImportWsspAssertion(assertions, "HttpsToken", out element))
{
bool flag = true;
string attribute = element.GetAttribute("RequireClientCertificate");
try
{
httpsBinding.RequireClientCertificate = XmlUtil.IsTrue(attribute);
}
catch (Exception exception)
{
if (Fx.IsFatal(exception))
{
throw;
}
if (exception is NullReferenceException)
{
throw;
}
importer.Errors.Add(new MetadataConversionError(System.ServiceModel.SR.GetString("UnsupportedBooleanAttribute", new object[] { "RequireClientCertificate", exception.Message }), false));
flag = false;
}
return flag;
}
return false;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:WSSecurityPolicy11.cs
示例3: GetPhasorDataServiceProxyClient
public static PhasorDataServiceClient GetPhasorDataServiceProxyClient()
{
string baseServiceUrl = Application.Current.Resources["BaseServiceUrl"].ToString();
EndpointAddress address = new EndpointAddress(baseServiceUrl + "Service/PhasorDataService.svc");
CustomBinding binding;
if (HtmlPage.Document.DocumentUri.Scheme.ToLower().StartsWith("https"))
{
HttpsTransportBindingElement httpsTransportBindingElement = new HttpsTransportBindingElement();
httpsTransportBindingElement.MaxReceivedMessageSize = int.MaxValue; // 65536 * 50;
binding = new CustomBinding(
new BinaryMessageEncodingBindingElement(),
httpsTransportBindingElement
);
}
else
{
HttpTransportBindingElement httpTransportBindingElement = new HttpTransportBindingElement();
httpTransportBindingElement.MaxReceivedMessageSize = int.MaxValue; // 65536 * 50;
binding = new CustomBinding(
new BinaryMessageEncodingBindingElement(),
httpTransportBindingElement
);
}
binding.CloseTimeout = new TimeSpan(0, 20, 0);
binding.OpenTimeout = new TimeSpan(0, 20, 0);
binding.ReceiveTimeout = new TimeSpan(0, 20, 0);
binding.SendTimeout = new TimeSpan(0, 20, 0);
return new PhasorDataServiceClient(binding, address);
}
开发者ID:JiahuiGuo,项目名称:openPDC,代码行数:32,代码来源:ProxyClient.cs
示例4: CreateWsspHttpsTokenAssertion
public override XmlElement CreateWsspHttpsTokenAssertion(MetadataExporter exporter, HttpsTransportBindingElement httpsBinding)
{
Fx.Assert(httpsBinding != null, "httpsBinding must not be null.");
Fx.Assert(httpsBinding.AuthenticationScheme.IsSingleton(), "authenticationScheme must be a singleton value for security-mode TransportWithMessageCredential.");
XmlElement result = CreateWsspAssertion(WSSecurityPolicy.HttpsTokenName);
if (httpsBinding.RequireClientCertificate ||
httpsBinding.AuthenticationScheme == AuthenticationSchemes.Basic ||
httpsBinding.AuthenticationScheme == AuthenticationSchemes.Digest)
{
XmlElement policy = CreateWspPolicyWrapper(exporter);
if (httpsBinding.RequireClientCertificate)
{
policy.AppendChild(CreateWsspAssertion(WSSecurityPolicy.RequireClientCertificateName));
}
if (httpsBinding.AuthenticationScheme == AuthenticationSchemes.Basic)
{
policy.AppendChild(CreateWsspAssertion(WSSecurityPolicy.HttpBasicAuthenticationName));
}
else if (httpsBinding.AuthenticationScheme == AuthenticationSchemes.Digest)
{
policy.AppendChild(CreateWsspAssertion(WSSecurityPolicy.HttpDigestAuthenticationName));
}
result.AppendChild(policy);
}
return result;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:27,代码来源:WSSecurityPolicy12.cs
示例5: ConfigureTransportProtectionAndAuthentication
internal static void ConfigureTransportProtectionAndAuthentication(this HttpTransportSecurity httpTransportSecurity, HttpsTransportBindingElement httpsTransportBindingElement)
{
Debug.Assert(httpTransportSecurity != null, "httpTransportSecurity cannot be null");
Debug.Assert(httpsTransportBindingElement != null, "httpsTransportBindingElement cannot be null");
httpTransportSecurity.ConfigureAuthentication(httpsTransportBindingElement);
httpsTransportBindingElement.RequireClientCertificate = httpTransportSecurity.ClientCredentialType == HttpClientCredentialType.Certificate;
}
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:8,代码来源:HttpTransportSecurityExtensionMethods.cs
示例6: ConfigureTransportProtectionAndAuthentication
internal static void ConfigureTransportProtectionAndAuthentication(HttpsTransportBindingElement https, HttpTransportSecurity transportSecurity)
{
ConfigureAuthentication(https, transportSecurity);
if (https.RequireClientCertificate)
{
transportSecurity.ClientCredentialType = HttpClientCredentialType.Certificate;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:HttpTransportSecurity.cs
示例7: HttpBindingBase
internal HttpBindingBase()
{
_httpTransport = new HttpTransportBindingElement();
_httpsTransport = new HttpsTransportBindingElement();
_textEncoding = new TextMessageEncodingBindingElement();
_textEncoding.MessageVersion = MessageVersion.Soap11;
_httpsTransport.WebSocketSettings = _httpTransport.WebSocketSettings;
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:9,代码来源:HttpBindingBase.cs
示例8: AddWindowsHttpsTransportBindingElement
private void AddWindowsHttpsTransportBindingElement(BindingElementCollection bindingElements)
{
HttpsTransportBindingElement item = new HttpsTransportBindingElement {
RequireClientCertificate = false,
UseDefaultWebProxy = false,
AuthenticationScheme = AuthenticationSchemes.Negotiate
};
bindingElements.Add(item);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:WindowsRequestReplyBinding.cs
示例9: CreateTransportBindingElement
private static HttpTransportBindingElement CreateTransportBindingElement(bool useTls){
if(useTls){
var transport = new HttpsTransportBindingElement();
transport.RequireClientCertificate = false;
return transport;
}else{
return new HttpTransportBindingElement();
}
}
开发者ID:zzilla,项目名称:ONVIF-Device-Manager,代码行数:9,代码来源:OnvifFactory.cs
示例10: Initialize
private void Initialize()
{
_securityBindingElement = CreateSecurityBindingElement();
_reliableSessionBindingElement = CreateReliableSessionBindingElement();
_mtomEncodingBindingElement = CreateMtomEncodingBindingElement();
_httpsTransportBindingElement = CreateHttpsTransportBindingElement() as HttpsTransportBindingElement;
}
开发者ID:gtkrug,项目名称:gfipm-ws-ms.net,代码行数:10,代码来源:WspCustomSecuredBinding.cs
示例11: EnableTransportSecurity
internal void EnableTransportSecurity(HttpsTransportBindingElement https)
{
if (this.mode == BasicHttpSecurityMode.TransportWithMessageCredential)
{
this.transportSecurity.ConfigureTransportProtectionOnly(https);
}
else
{
this.transportSecurity.ConfigureTransportProtectionAndAuthentication(https);
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:11,代码来源:BasicHttpSecurity.cs
示例12: Initialize
private void Initialize()
{
_securityBindingElement = CreateSecurityBindingElement();
_reliableSessionBindingElement = CreateReliableSessionBindingElement();
_textEncodingBindingElement = CreateTextEncodingBindingElement();
_httpsTransportBindingElement = CreateHttpsTransportBindingElement();
//_httpTransportBindingElement = CreateHttpTransportBindingElement();
}
开发者ID:gtkrug,项目名称:gfipm-ws-ms.net,代码行数:12,代码来源:AdsCustomSecuredBinding.cs
示例13: HttpBindingBase
internal HttpBindingBase()
{
this.httpTransport = new HttpTransportBindingElement();
this.httpsTransport = new HttpsTransportBindingElement();
this.textEncoding = new TextMessageEncodingBindingElement();
this.textEncoding.MessageVersion = MessageVersion.Soap11;
this.mtomEncoding = new MtomMessageEncodingBindingElement();
this.mtomEncoding.MessageVersion = MessageVersion.Soap11;
this.httpsTransport.WebSocketSettings = this.httpTransport.WebSocketSettings;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:HttpBindingBase.cs
示例14: CreateHttpsTransportBindingElement
private HttpsTransportBindingElement CreateHttpsTransportBindingElement()
{
HttpsTransportBindingElement transportBindingElement = new HttpsTransportBindingElement();
// When set to true, the IIS Site application must have the SSL require certificate set
transportBindingElement.RequireClientCertificate = false;
transportBindingElement.MaxBufferSize = 524288;
transportBindingElement.MaxReceivedMessageSize = 200000000;
transportBindingElement.MaxBufferSize = 200000000;
return transportBindingElement;
}
开发者ID:gtkrug,项目名称:gfipm-ws-ms.net,代码行数:13,代码来源:IdpStsCustomSecuredBinding.cs
示例15: Initialize
private void Initialize()
{
this.httpTransport = new HttpTransportBindingElement();
this.httpsTransport = new HttpsTransportBindingElement();
this.messageEncoding = WSMessageEncoding.Text;
this.txFlow = GetDefaultTransactionFlowBindingElement();
this.session = new System.ServiceModel.Channels.ReliableSessionBindingElement(true);
this.textEncoding = new TextMessageEncodingBindingElement();
this.textEncoding.MessageVersion = MessageVersion.Soap12WSAddressing10;
this.mtomEncoding = new MtomMessageEncodingBindingElement();
this.mtomEncoding.MessageVersion = MessageVersion.Soap12WSAddressing10;
this.reliableSession = new OptionalReliableSession(this.session);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:WSHttpBindingBase.cs
示例16: TryImportWsspHttpsTokenAssertion
public override bool TryImportWsspHttpsTokenAssertion(MetadataImporter importer, ICollection<XmlElement> assertions, HttpsTransportBindingElement httpsBinding)
{
if (assertions == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("assertions");
}
bool result = true;
XmlElement assertion;
if (TryImportWsspAssertion(assertions, HttpsTokenName, out assertion))
{
XmlElement policyElement = null;
foreach (XmlNode node in assertion.ChildNodes)
{
if (node is XmlElement && node.LocalName == WSSecurityPolicy.PolicyName && (node.NamespaceURI == WSSecurityPolicy.WspNamespace || node.NamespaceURI == WSSecurityPolicy.Wsp15Namespace))
{
policyElement = (XmlElement)node;
break;
}
}
if (policyElement != null)
{
foreach (XmlNode node in policyElement.ChildNodes)
{
if (node is XmlElement && node.NamespaceURI == this.WsspNamespaceUri)
{
if (node.LocalName == WSSecurityPolicy.RequireClientCertificateName)
{
httpsBinding.RequireClientCertificate = true;
}
else if (node.LocalName == WSSecurityPolicy.HttpBasicAuthenticationName)
{
httpsBinding.AuthenticationScheme = AuthenticationSchemes.Basic;
}
else if (node.LocalName == WSSecurityPolicy.HttpDigestAuthenticationName)
{
httpsBinding.AuthenticationScheme = AuthenticationSchemes.Digest;
}
}
}
}
}
else
{
result = false;
}
return result;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:51,代码来源:WSSecurityPolicy12.cs
示例17: NetHttpBinding
public NetHttpBinding(NetHttpSecurityMode securityMode)
{
if (securityMode != NetHttpSecurityMode.Transport &&
securityMode != NetHttpSecurityMode.TransportCredentialOnly &&
securityMode != NetHttpSecurityMode.None)
{
throw new ArgumentOutOfRangeException("securityMode");
}
this.securityMode = securityMode;
this.httpTransport = new HttpTransportBindingElement();
this.httpsTransport = new HttpsTransportBindingElement();
this.binaryEncoding = new BinaryMessageEncodingBindingElement();
}
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:14,代码来源:NetHttpBinding.cs
示例18: GetProperty
public void GetProperty ()
{
var b = new HttpsTransportBindingElement ();
var s = b.GetProperty<ISecurityCapabilities> (new BindingContext (new CustomBinding (), new BindingParameterCollection ()));
Assert.IsNotNull (s, "#1");
Assert.AreEqual (ProtectionLevel.EncryptAndSign, s.SupportedRequestProtectionLevel, "#2");
Assert.AreEqual (ProtectionLevel.EncryptAndSign, s.SupportedResponseProtectionLevel, "#3");
Assert.IsFalse (s.SupportsClientAuthentication, "#4");
Assert.IsFalse (s.SupportsClientWindowsIdentity, "#5");
Assert.IsTrue (s.SupportsServerAuthentication, "#6");
b.RequireClientCertificate = true;
s = b.GetProperty<ISecurityCapabilities> (new BindingContext (new CustomBinding (), new BindingParameterCollection ()));
Assert.IsTrue (s.SupportsClientAuthentication, "#7");
Assert.IsTrue (s.SupportsClientWindowsIdentity, "#8");
}
开发者ID:nickchal,项目名称:pash,代码行数:16,代码来源:HttpsTransportBindingElementTest.cs
示例19: GeocachingLiveV6
public GeocachingLiveV6(bool testSite)
{
BinaryMessageEncodingBindingElement binaryMessageEncoding = new BinaryMessageEncodingBindingElement()
{
ReaderQuotas = new XmlDictionaryReaderQuotas()
{
MaxStringContentLength = int.MaxValue,
MaxBytesPerRead = int.MaxValue,
MaxDepth = int.MaxValue,
MaxArrayLength = int.MaxValue
}
};
HttpTransportBindingElement httpTransport = new HttpsTransportBindingElement()
{
MaxBufferSize = int.MaxValue,
MaxReceivedMessageSize = int.MaxValue,
AllowCookies = false,
//UseDefaultWebProxy = true,
};
// add the binding elements into a Custom Binding
CustomBinding binding = new CustomBinding(binaryMessageEncoding, httpTransport);
EndpointAddress endPoint;
if (testSite)
{
endPoint = new EndpointAddress("https://staging.api.groundspeak.com/Live/V6Beta/geocaching.svc/Silverlightsoap");
_token = Core.Settings.Default.LiveAPITokenStaging;
}
else
{
endPoint = new EndpointAddress("https://api.groundspeak.com/LiveV6/Geocaching.svc/Silverlightsoap");
_token = Core.Settings.Default.LiveAPIToken;
}
try
{
_client = new LiveV6.LiveClient(binding, endPoint);
}
catch(Exception e)
{
Core.ApplicationData.Instance.Logger.AddLog(this, e);
}
}
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:47,代码来源:GeocachingLive.cs
示例20: GeocachingLiveV6
public GeocachingLiveV6(Framework.Interfaces.ICore core, bool testSite)
{
_core = core;
BinaryMessageEncodingBindingElement binaryMessageEncoding = new BinaryMessageEncodingBindingElement()
{
ReaderQuotas = new XmlDictionaryReaderQuotas()
{
MaxStringContentLength = int.MaxValue,
MaxBytesPerRead = int.MaxValue,
MaxDepth = int.MaxValue,
MaxArrayLength = int.MaxValue
}
};
HttpTransportBindingElement httpTransport = new HttpsTransportBindingElement()
{
MaxBufferSize = int.MaxValue,
MaxReceivedMessageSize = int.MaxValue,
AllowCookies = false,
};
// add the binding elements into a Custom Binding
CustomBinding binding = new CustomBinding(binaryMessageEncoding, httpTransport);
EndpointAddress endPoint;
if (testSite)
{
endPoint = new EndpointAddress("https://staging.api.groundspeak.com/Live/V6Beta/geocaching.svc/Silverlightsoap");
_token = core.GeocachingComAccount.APITokenStaging;
}
else
{
endPoint = new EndpointAddress("https://api.groundspeak.com/LiveV6/Geocaching.svc/Silverlightsoap");
_token = core.GeocachingComAccount.APIToken;
}
try
{
_client = new LiveV6.LiveClient(binding, endPoint);
}
catch
{
}
}
开发者ID:RH-Code,项目名称:GAPP,代码行数:46,代码来源:GeocachingLive.cs
注:本文中的HttpsTransportBindingElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论