2011-03-09 5 views
0

오늘 custom binding을 사용하여 사용자 지정 서비스 호스트를 호스팅하는 데 문제가 있습니다. 나는 ServiceHostFactory를 구현하려고 시도했지만 브라우저에서보기 위해 오른쪽 버튼을 클릭 할 때 IIS가 사용자 정의 바인딩 (duplexHttpBinding)을 인식하지 못하기 때문에 오류가 발생했습니다.내 IIS가 내 WCF 사용자 지정 바인딩을 인식하지 못함

내 Web.config의는 여기에 있습니다 :

public class CustomServiceHost : ServiceHostFactory 
{ 
    public override ServiceHostBase CreateServiceHost(string service, Uri[] baseAddresses) 
    { 
     DuplexHttpBinding binding = new DuplexHttpBinding(); 
     binding.Name = "binding1"; 

     Uri baseAddress = new Uri("http://localhost:8888/Service1"); 
     Uri address = new Uri("http://localhost:9999/Service1"); 


     ServiceHost serviceHost = new ServiceHost(typeof(Service1), baseAddresses); 
     serviceHost.AddServiceEndpoint(typeof(IService1), binding, address); 

     return serviceHost; 
    } 
} 

및 SVC 파일에

<%@ ServiceHost Language="C#" Debug="true" Service="TestWcf.Service1" Factory="TestWcf.CustomServiceHost" %> 

내가 뭔가를 놓치지 마십시오

<services> 
     <service name="TestWcf.Service1" 
      behaviorConfiguration="Service1Behavior"> 
      <host> 
       <baseAddresses> 
        <add baseAddress="http://localhost:8888/Service1"/> 
       </baseAddresses> 
      </host> 
      <endpoint 
       address="http://localhost:9999/Service1" 
       binding="duplexHttpBinding" 
       bindingConfiguration="binding1" 
       contract="TestWcf.IService" /> 
     </service> 
    </services> 

    <bindings> 
     <duplexHttpBinding> 
      <binding name="binding1" 
        closeTimeout="00:01:00" 
        openTimeout="00:01:00" 
        receiveTimeout="24.20:31:23.6470000" 
        sendTimeout="02:01:00" 
        session="ReliableSession" 
        sessionTimeout="00:10:00" 
        maxUndeliveredMessages="100" 
        maxMessagesInBatch="10" 
        maxPollingReplyInterval="00:02:00"> 
      </binding> 
     </duplexHttpBinding> 
    </bindings> 

    <behaviors> 
     <serviceBehaviors> 
      <behavior name="Service1Behavior"> 
       <serviceMetadata httpGetEnabled="True" /> 
       <serviceDebug includeExceptionDetailInFaults="True" /> 
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 

및 dervied 클래스의 코드

가 여기에있다 문맥?

감사합니다.

답변

0

새 바인딩을 구성 파일에 binding extension으로 등록해야합니다.

+0

고마워. 내가 한 후에도 "프로토콜 바인딩이 주어진 주소"http : // localhost : 9999/Service1 "과 일치하지 않는다는 오류가 발견되었습니다. 프로토콜 바인딩은 IIS 또는 WAS 구성의 사이트 수준에서 구성됩니다. " 그것에 대한 어떤 제안? – tong

+0

Https를 사용 중입니다. 이 경우 사용자 정의 바인딩은 httpsTransport 채널을 사용해야합니다. 바인딩 구성에 보안 요소가 있습니까? 그렇다면 전송 모드로 구성해야합니다. –

관련 문제