/// <summary> /// Configure the Bindings, endpoints and open the service using the specified address. /// </summary> /// <returns>An instance of the Web Service.</returns> public static DocumentConverterServiceClient OpenService(string address) { DocumentConverterServiceClient client = null; try { BasicHttpBinding binding = new BasicHttpBinding(); // ** Use standard Windows Security. binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows; // ** Increase the client Timeout to deal with (very) long running requests. binding.SendTimeout = TimeSpan.FromMinutes(120); binding.ReceiveTimeout = TimeSpan.FromMinutes(120); // ** Set the maximum document size to 50MB binding.MaxReceivedMessageSize = 50 * 1024 * 1024; binding.ReaderQuotas.MaxArrayLength = 50 * 1024 * 1024; binding.ReaderQuotas.MaxStringContentLength = 50 * 1024 * 1024; // ** Specify an identity (any identity) in order to get it past .net3.5 sp1 EndpointIdentity epi = new UpnEndpointIdentity("unknown"); EndpointAddress epa = new EndpointAddress(new Uri(address), epi); client = new DocumentConverterServiceClient(binding, epa); client.OpenAsync().GetAwaiter().GetResult(); return(client); } catch (Exception) { CloseService(client); throw; } }
public UpnEndpointIdentityExtension(UpnEndpointIdentity identity) { if (identity == null) { throw FxTrace.Exception.ArgumentNull("identity"); } this.UpnName = (string)identity.IdentityClaim.Resource; }
public static void Ctor_NullUpn() { string upnName = null; Assert.Throws <ArgumentNullException>("upnName", () => { UpnEndpointIdentity upnEndpointEntity = new UpnEndpointIdentity(upnName); }); }
public UpnEndpointIdentityExtension(UpnEndpointIdentity identity) { if (identity == null) { throw FxTrace.Exception.ArgumentNull("identity"); } Fx.Assert(identity.IdentityClaim.Resource is string, "UpnEndpointIdentity claim resource is not string"); this.UpnName = (string)identity.IdentityClaim.Resource; }
public UpnEndpointIdentityExtension(UpnEndpointIdentity identity) { if (identity == null) { throw FxTrace.Exception.ArgumentNull("identity"); } Fx.Assert(identity.IdentityClaim.Resource is string, "UpnEndpointIdentity claim resource is not string"); this.UpnName = (string)identity.IdentityClaim.Resource; }
internal static EndpointIdentity CreateWindowsIdentity(bool spnOnly) { EndpointIdentity identity = null; using (WindowsIdentity self = WindowsIdentity.GetCurrent()) { bool isSystemAccount = IsSystemAccount(self); if (spnOnly || isSystemAccount) { identity = EndpointIdentity.CreateSpnIdentity(String.Format(CultureInfo.InvariantCulture, "host/{0}", DnsCache.MachineName)); } else { // Save windowsIdentity for delay lookup identity = new UpnEndpointIdentity(CloneWindowsIdentityIfNecessary(self)); } } return(identity); }
public static void Ctor_UpnName(string upn) { UpnEndpointIdentity upnEndpointEntity = new UpnEndpointIdentity(upn); }