2013-01-06 4 views
0

먼저 svc 파일이 생성되는 WCF 서비스 응용 프로그램을 만듭니다. 그런 다음 소규모 서비스 관련 코드를 작성합니다. F5를 누르면 wcf 테스트 클라이언트가 잘 나타나고 svc 파일을 선택하고 브라우저 옵션에서보기를 선택하면 모든 것이 올바르게 작동합니다.. 처음에는 설정 파일에 단 하나의 끝점이 있습니다 ... wsDualHttpBinding 그런 다음 정상적으로 작동합니다.'net.tcp'프로토콜이 지원되지 않습니다. WCF와 관련된 문제

netTcpBinding라고하는 다른 끝점을 추가하는 순간 문제가 시작됩니다. 구성 파일에 netTcpBinding 끝점을 추가 한 후 브라우저에서 svc 파일을 다시 탐색하려고하면 이라는 오류 메시지가 나타납니다. 'net.tcp'프로토콜이 지원되지 않습니다. 그리고 F5를 누르면 wcf 테스트 클라이언트에서 오류 메시지가 표시됩니다. ** Cannot obtain Metadata from http://localhost:30996/ChatService.svc**

netTcpBinding을 추가 할 때 왜 그런지 이해가 안됩니다. 나는 어디서나 나의 서비스를 접대하지 못했다고 말하고 싶다. 난 그냥 WCF 서비스 응용 프로그램을 만들고 web.config 파일에있는 모든 항목을 추가하고 그냥 F5 키를 누릅니다. 내가 어디서나 내 서비스를 호스팅하지 않았기 때문에 이것이 오류가 발생하는 이유는 무엇입니까? 단지 난 내 config 파일에서 변경할 필요 .... 실종 무엇인지 말해

<?xml version="1.0"?> 
<configuration> 

    <system.web> 
     <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 

    <system.serviceModel> 
    <services> 
     <service name="BBAChatService.ChatService" behaviorConfiguration="BBAChatService.ChatServiceBehavior" > 
     <host> 
      <baseAddresses> 
      <add baseAddress ="http://localhost:30996/ChatService.svc/"/> 
      <add baseAddress ="net.tcp://localhost:30997/ChatService/"/> 
      </baseAddresses> 
     </host> 

     <endpoint name="dual_bind" 
        address="dual" 
        binding="wsDualHttpBinding" 
        bindingConfiguration="WSDualHttpBinding_IChatService" 
        contract="BBAChatService.IChatService"> 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 

     <endpoint name="tcp_bind" 
       address="net.tcp://localhost:30997/ChatService" 
       binding="netTcpBinding" 
       bindingConfiguration="tcpBinding" 
       contract="BBAChatService.IChatService"> 
     </endpoint> 

     <endpoint address="net.tcp://localhost:30997/ChatService/mex" 
          binding="mexTcpBinding" 
          contract="IMetadataExchange"/> 


     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="BBAChatService.ChatServiceBehavior"> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true"/> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <bindings> 
     <netTcpBinding> 
     <binding name="tcpBinding" 
         maxBufferSize="67108864" 
         maxReceivedMessageSize="67108864" 
         maxBufferPoolSize="67108864" 
         transferMode="Buffered" 
         closeTimeout="00:00:10" 
         openTimeout="00:00:10" 
         receiveTimeout="00:20:00" 
         sendTimeout="00:01:00" 
       portSharingEnabled="true" 
         maxConnections="100"> 
      <security mode="None"> 
      </security> 
      <readerQuotas maxArrayLength="67108864" 
            maxBytesPerRead="67108864" 
            maxStringContentLength="67108864"/> 
      <reliableSession enabled="true" inactivityTimeout="00:20:00"/> 
     </binding> 
     </netTcpBinding> 
     <wsDualHttpBinding> 
     <binding name="WSDualHttpBinding_IChatService" 
       closeTimeout="00:01:00" 
       openTimeout="00:01:00" 
       receiveTimeout="00:10:00" 
       sendTimeout="00:01:00" 
       bypassProxyOnLocal="false" 
       transactionFlow="false" 
       hostNameComparisonMode="StrongWildcard" 
       maxBufferPoolSize="524288" 
       maxReceivedMessageSize="65536" 
       messageEncoding="Text" 
       textEncoding="utf-8" 
       useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="32" 
         maxStringContentLength="8192" 
         maxArrayLength="16384" 
         maxBytesPerRead="4096" 
         maxNameTableCharCount="16384"/> 
      <reliableSession 
      ordered="true" 
      inactivityTimeout="00:10:00"/> 
      <security mode="Message"> 
      <message clientCredentialType="Windows" 
        negotiateServiceCredential="true" 
        algorithmSuite="Default"/> 
      </security> 
     </binding> 
     </wsDualHttpBinding> 
    </bindings> 
    </system.serviceModel> 
</configuration> 

을 다음과 같이

그래서 여기 내 설정 세부 사항입니다.

여기 내 프로젝트 솔루션 탐색기의 스크린 샷입니다.

enter image description here

답변

2

내장 당신이 그것을에 net.tcp 엔드 포인트를 호스트 할 수 없습니다 있도록 F5는 HTTP 활성화를 지원 쳤을 때 VS에서 사용되는 웹 서버입니다. 당신도 할 수 있습니다 IIS에서

  • 호스트를 (비 HTTP 활성화에 사용)
  • 는 설치의 DIR %의 VS %에서 발견 될 수있는 서비스
  • 사용 WcfSvcHost.exe에 대한 간단한 호스트 어플리케이션을 작성한다 \ Common7 \ IDE

당신은 서비스가 제대로 당신이 (바인딩 유형은 mexTcpBinding이다) 그것을 위해 메타 데이터 교환 끝점을 만들어야합니다 호스팅하고 net.tcp에 대한 동작 구성에 falsehttpGetEnabled을 설정하면 엔드 포인트.

편집 :이 WcfSvcHost.exe 자세한 사용 설명은 this msdn article를 참조하십시오. httpGetEnabled에 관해서는 net.tcp 서비스 엔드 포인트의 동작에서 serviceMetadata에 false로 설정하려고했습니다.

<serviceBehaviors> 
    <behavior name="BehaviorName"> 
     <serviceMetadata httpGetEnabled="false" /> 
    </behavior> 
<serviceBehaviors> 

그런 다음이 동작을 net.tcp 끝점에 적용하십시오. 이 엔드 포인트에 대해 HTTP가 아닌 TCP를 통해 메타 데이터를 노출하려는 경우 mexTcpBinding 엔드 포인트를 포함해야합니다.

+0

답변을 주셔서 감사합니다. 어떻게 WcfSvcHost.exe로 서비스를 호스팅 할 수 있습니까? 나는 u가 내 서비스가 두 개의 끝점 하나를 가지고 있고 다른 하나가 tcp라고 생각한다. 두 끝점 모두에 대해 WcfSvcHost.exe를 사용하여 호스트 할 수 있다고 말해주십시오. httpGetEnabled = false로 설정해야하는 이유는 무엇입니까 ?? 나는 그것을하지 않으면 어떤 문제가 발생할 수 있습니다. 덕분에 – Thomas

+0

내가 왜 httpGetEnabled false로 설정해야합니다.나는 그것이 틀린 경우에 서비스가 대리 창조의 때에 발견되지 않을 것이라는 점을 나는 생각한다. 왜 httpGetEnabled를 false로 설정해야하는지 알려주세요. – Thomas

+0

답변을 주셔서 감사합니다. 결과적으로 httpGetEnabled = false를 설정할 위치를 시각화 할 수 있기 때문에 httpGetEnabled에 대한 작은 구성 코드 청크를 제공하면 도움이 될 것입니다. 감사합니다 – Thomas