:
<bindings>
<basicHttpBinding>
<binding name="secured">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="userName" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="securedService">
<serviceMetadata httpsGetEnabled="true" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Namespace.Type, assembly" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Namespace.Type" behaviorConfiguration="securedService">
<host>
<baseAddresses>
<!-- some url -->
<baseAddress baseAddress="https://localhost:8088/Service" />
</baseAddresses>
</host>
<endpoint address="" contract="Namespace.Type" binding="basicHttpBinding" bindingConfiguration="secured" />
<endpoint address="mex" contract="IMetadataExchange" binding="mexHttpsBinding" />
</service>
</services>
이 메시지에 자격 증명을 운반 HTTPS 및 사용자 이름 토큰 프로필을 사용하여 SOAP 1.1 서비스를 생성합니다. 또한 HTTPS를 통해 메타 데이터 (WSDL)를 노출하고 사용자 이름과 암호는 custom validator에 의해 유효성이 검사됩니다. 기본 유효성 검사는 Windows 계정의 유효성을 검사하지만 ASP.NET 멤버 자격 공급자를 사용하도록 다시 구성 할 수도 있습니다.
마지막으로해야 할 일은 사용 된 포트 (이 예에서는 8088)에 HTTPS를 허용하는 것입니다. 이를 위해 컴퓨터의 인증서 저장소에 개인 키가 설치된 인증서가 필요합니다 (LocalMachine의 내/개인 저장소에 있어야 함). 테스트 용으로 self signed certificate을 만들 수 있습니다.
인증서를 얻었 으면 netsh를 사용하여 assign the certificate to the port을 입력해야합니다. 또한 netsh를 사용하여 allow application to listen on the port을 지정해야합니다. 그렇지 않으면 콘솔 응용 프로그램을 admin (UAC - Windows Vista, 7, 2008, 2008 R2)으로 실행해야합니다.
기본적으로 netTcpBinding이 보안됩니다 (Windows 인증 필요, 메시지 서명 및 암호화) – lnu