Windows Server 2012 또는 Windows 8 .NET Framework WCF 서비스를 호스트할 때 오류 발생

이 문서에서는 Windows Server 2012 또는 Windows 8 비 HTTP 활성화를 사용하는 .NET Framework 3.5 Windows Communication Foundation(WCF) 서비스를 호스트할 때 발생하는 오류를 resolve 수 있습니다.

원래 제품 버전: Microsoft .NET Framework Windows Communication Foundation, Windows Server 2012, Windows 8
원래 KB 번호: 2803161

증상

다음과 같은 경우를 생각해볼 수 있습니다.

  • .NET Framework 3.5 WCF 서비스는 다음 컴퓨터 중 하나에서 호스트됩니다.
    • Windows Server 2012 또는 Windows 8 클린 설치를 실행하는 컴퓨터입니다.
    • Windows Server 2008 R2에서 업그레이드된 Windows Server 2012 버전을 실행하는 컴퓨터 또는 Windows 7에서 업그레이드된 Windows 8 버전입니다. WCF 비 HTTP 활성화 기능(예: NET) 컴퓨터가 Windows Server 2012 또는 Windows 8 업그레이드되기 전에는 이 컴퓨터의 TCP)가 사용하도록 설정되지 않았습니다.
  • Windows Server 2012 또는 Windows 8 호스트되는 WCF 서비스가 호출됩니다.

이 경우 다음과 유사한 내용의 오류 메시지가 나타납니다.

예외: System.InvalidOperationException: 프로토콜 'net.tcp'에 HostedTransportConfiguration 형식이 등록되어 있지 않습니다.
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
에서 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult 결과)

참고

이 문제는 .NET Framework 3.5 WCF 서비스가 Windows Server 2008 R2 또는 Windows 7을 실행하는 컴퓨터에서 비 HTTP 활성화를 사용하는 IIS 버전에서 호스트되는 경우 발생하지 않습니다.

해결 방법

이 문제를 해결하려면 다음 방법 중 하나를 사용합니다.

방법 1

Web.config 파일의 루트를 수동으로 변경합니다. 이를 위해 다음 작업을 수행하십시오.

경고

Web.config 파일을 잘못 변경하면 ASP.NET 애플리케이션이 작동하지 않을 수 있습니다. Web.config 파일을 변경하기 전에 백업하는 것이 좋습니다.

  1. 메모장과 같은 텍스트 편집기에서 관리자 권한으로 다음 파일을 엽니다.

    %windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config

  2. 태그 앞에 다음 구성 섹션을 추가합니다 </configuration> .

    참고

    </configuration> 태그는 파일의 맨 아래에 있습니다.

    <system.serviceModel>
       <serviceHostingEnvironment>
          <add name="net.tcp" transportConfigurationType="System.ServiceModel.Activation.TcpHostedTransportConfiguration, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
          <add name="net.pipe" transportConfigurationType="System.ServiceModel.Activation.NamedPipeHostedTransportConfiguration, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
          <add name="net.msmq" transportConfigurationType="System.ServiceModel.Activation.MsmqHostedTransportConfiguration, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
          <add name="msmq.formatname" transportConfigurationType="System.ServiceModel.Activation.MsmqIntegrationHostedTransportConfiguration, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
       </serviceHostingEnvironment>
    </system.serviceModel>
    
  3. 아직 없는 경우 파일에 다음 구성 섹션을 추가합니다.

    <protocols>
       <add name="net.tcp" processHandlerType="System.ServiceModel.WasHosting.TcpProcessProtocolHandler, System.ServiceModel.WasHosting, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
          appDomainHandlerType="System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler, System.ServiceModel.WasHosting, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
          validate="false" />
       <add name="net.pipe" processHandlerType="System.ServiceModel.WasHosting.NamedPipeProcessProtocolHandler, System.ServiceModel.WasHosting, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
          appDomainHandlerType="System.ServiceModel.WasHosting.NamedPipeAppDomainProtocolHandler, System.ServiceModel.WasHosting, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
          validate="false" />
       <add name="net.msmq" processHandlerType="System.ServiceModel.WasHosting.MsmqProcessProtocolHandler, System.ServiceModel.WasHosting, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
          appDomainHandlerType="System.ServiceModel.WasHosting.MsmqAppDomainProtocolHandler, System.ServiceModel.WasHosting, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
          validate="false" />
       <add name="msmq.formatname" processHandlerType="System.ServiceModel.WasHosting.MsmqIntegrationProcessProtocolHandler, System.ServiceModel.WasHosting, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
          appDomainHandlerType="System.ServiceModel.WasHosting.MsmqIntegrationAppDomainProtocolHandler, System.ServiceModel.WasHosting, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
          validate="false" />
    </protocols>
    
  4. 파일을 저장합니다.

파일을 저장한 후 동일한 단계에 따라 다음 파일을 변경한 다음 컴퓨터를 다시 시작합니다.

%windir%\Microsoft.NET\Framework64\v2.0.50727\CONFIG\web.config

참고

이 메서드는 컴퓨터에 최소한의 영향을 주므로 이 메서드를 적용하여 문제를 해결하는 것이 좋습니다. 이러한 변경 내용은 Web.config 파일에만 적용되며 다른 ASP.NET 애플리케이션에는 영향을 미치지 않습니다.

방법 2

SmconfigInstaller.exe 실행하여 Web.config 파일을 업데이트합니다.

경고

이 메서드는 문제를 resolve 데 필요한 것보다 Web.config 및 IIS 애플리케이션 Host.config 파일에서 더 많은 구성을 업데이트할 수 있습니다. 업데이트된 구성은 컴퓨터에서 호스트되고 구성된 ASP.NET 2.0, ASP.NET 3.0 및 ASP.NET 3.5 애플리케이션 수에 따라 달라집니다. 이 메서드를 사용하는 경우 변경해서는 안 되는 다른 ASP.NET 애플리케이션을 사용하는 경우 주의해야 합니다.

  • 32비트 운영 체제를 실행하는 컴퓨터에서 SMConfigInstaller.exe 실행하려면 다음 단계를 수행합니다.

    1. 명령 프롬프트에서 다음 명령을 입력한 후 Enter 키를 누릅니다.

      %windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\SMConfigInstaller.exe -c:install -f:tcp -f:pipe -f:msmq -f:http

    2. 컴퓨터를 다시 시작합니다.

  • 64비트 운영 체제를 실행하는 컴퓨터에서 SMConfigInstaller.exe 실행하려면 다음 단계를 수행합니다.

    1. 64비트 명령 프롬프트에서 다음 명령을 입력한 다음 Enter 키를 누릅니 .

      %windir%\Microsoft.NET\Framework64\v3.0\Windows Communication Foundation\SMConfigInstaller.exe -c:install -f:tcp -f:pipe -f:msmq -f:http

    2. 32비트 명령 프롬프트에서 다음 명령을 입력한 다음 Enter 키를 누릅니 .

      %windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\SMConfigInstaller.exe -c:install -f:tcp -f:pipe -f:msmq -f:http

    3. 컴퓨터를 다시 시작합니다.