2010-11-18 3 views
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 
    } 
} 

는 보안 모드를 변경할 수 있습니까?

답변

0

끝점 동작을 통해이를 수행 할 수 있다고 생각하지 않습니다. 행동은 바인딩 구성을 조기에 수정할 수 없습니다.

Howver, 코드에서 다른 방법으로 수행 할 수 있습니다. 은 BasicHttpBinding 보안 모드를 지정할 수 있습니다 생성자 오버로드가 있습니다

BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport); 

이 서비스가 시작되기 전에 수행해야합니다, 당신은 ServiceHost를하고 엔드 포인트를 직접 만드는 가정합니다.

+0

그래, 내 문제는 바인딩 생성을 제어 할 수 없다고 생각하는 것입니다. IList 의 인수를 취하는 타사 라이브러리를 사용하고 있는데 그렇지 않으면 바인딩 정보를 지정할 수 없습니다. –

+0

나는 당신의 제안과 비슷한 것을하고 결국 바인딩의 생성을 도청했다. 이것은 의도 된대로 제 3 자 구성을 실제로 사용할 수 없다는 것을 의미했지만 괜찮습니다. –