0
有没有办法在运行时设置basicHttpBinding配置中通常指定的传输安全性,可能是通过实现IEndpointBehavior?使用IEndpointBehavior在WCF绑定上设置传输安全性?
本质借此:
<binding name="DfsAgentService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="1000000" maxBufferPoolSize="10000000" maxReceivedMessageSize="1000000" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="None"/><!--Transport-->
</binding>
,并使用此(或别的东西),而不是:
namespace Endpoints {
class DfsEndpoint : IEndpointBehavior{
#region IEndpointBehavior Members
void IEndpointBehavior.AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) {
throw new NotImplementedException();
}
void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime) {
throw new NotImplementedException();
}
void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) {
throw new NotImplementedException();
}
void IEndpointBehavior.Validate(ServiceEndpoint endpoint) {
throw new NotImplementedException();
}
#endregion
}
}
是否有可能改变安全模式?
是的,我的问题是,我不认为我能控制绑定的创建。我正在使用一个采用IList的arg的第三方库,但否则不允许指定绑定信息。 –
2010-11-19 17:06:09
我最终做了一些类似于你的建议,并截获了绑定的创建。这意味着我无法按照预期的方式真正使用第三方配置,但这很好。 – 2010-12-17 22:24:29