WSFederationHttpBinding を使用するとパフォーマンスが非常に悪くなります。iis は 1 秒あたり 250 リクエストしか処理しません。
バインディング:
public class CustomFactoryActive : ServiceHostFactory
{
protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
{
ServiceHost host = new ServiceHost(serviceType, baseAddresses);
CommonConf.ConfigureServiceHost(host);
string issuerAddress = ConfigManager.ActiveSTS;
string issuerMexAddress = issuerAddress + "/mex";
WSFederationHttpBinding wsFedBinding = new WSFederationHttpBinding();
wsFedBinding.Security.Mode = WSFederationHttpSecurityMode.Message;
wsFedBinding.ReliableSession.Enabled = false;
wsFedBinding.MaxReceivedMessageSize = wsFedBinding.MaxBufferPoolSize = Constants.MaxFileSize;
XmlDictionaryReaderQuotas quotas = wsFedBinding.ReaderQuotas;
quotas.MaxArrayLength = quotas.MaxBytesPerRead = quotas.MaxStringContentLength =
quotas.MaxNameTableCharCount = quotas.MaxDepth = (int)Constants.MaxFileSize;
var messageSecurity = wsFedBinding.Security.Message;
messageSecurity.IssuedTokenType = "http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1";
messageSecurity.IssuedKeyType = SecurityKeyType.SymmetricKey;
messageSecurity.EstablishSecurityContext = false;
messageSecurity.NegotiateServiceCredential = false;
messageSecurity.IssuerAddress = new EndpointAddress(new Uri(issuerAddress));
messageSecurity.IssuerMetadataAddress = new EndpointAddress(new Uri(issuerMexAddress));
WS2007HttpBinding ws2007HttpBinding = new WS2007HttpBinding(SecurityMode.TransportWithMessageCredential);
var wsHttpSecurity = ws2007HttpBinding.Security;
wsHttpSecurity.Message.ClientCredentialType = MessageCredentialType.UserName;//авторизация по логину и паролю
wsHttpSecurity.Message.NegotiateServiceCredential = true;
wsHttpSecurity.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default;
messageSecurity.IssuerBinding = ws2007HttpBinding;
ContractDescription contractDescription = ContractDescription.GetContract(typeof(ISignService));
EndpointAddress endpointAddress = new EndpointAddress(baseAddresses[0]);
ServiceEndpoint endpoint = new ServiceEndpoint(contractDescription, wsFedBinding, endpointAddress);
host.Description.Endpoints.Add(endpoint);
return host;
}
}
私の wcf テスト メソッドは何もしません。単に 1 バイトを返します。
しかし、WIF saml トークンを使用せずにメッセージ セキュリティで単純な WSHttpBinding を使用すると、約 . 毎秒 4000 リクエスト
なぜだか理解できない