WCF의 가장에 관한 질문이 있습니다. 클라이언트 응용 프로그램에서 호출하는 WCF Windows 서비스의 DB에 연결하고 싶습니다. DB에 대한 연결은 서비스가 실행되는 계정을 사용하여 수행되어야합니다. 그러나 WCF 서비스에 대한 호출이 신뢰할 수있는 소스 (클라이언트 응용 프로그램의 사용자가 도메인의 Autenticated 사용자임을 확인)로부터 호출되었는지 확인하고 싶습니다.WCF Windows 서비스 DB 연결 및 가장 질문
내가 사용하도록 조언하는 종류의 보안은 무엇입니까?
내가 가장을 시도,하지만 난 Windows 서비스에서 DB에 연결을 시도하는이 오류를 얻을 :System.Data.SqlClient.SqlException을 : 로그인 'NT AUTHORITY \ ANONYMOUS LOGON'사용자가 실패 .
구성 문자열은 다음과 같다 :
서버 =이 myServer; 초기 카탈로그 = MYDATABASE; 통합 보안 = 진정한
서비스의 WCF 구성은 다음과 같습니다
를<system.serviceModel>
<services>
<service name="MyNamespace.MyService"
behaviorConfiguration="TransfertServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8095/MyNamespace.MyService"/>
</baseAddresses>
</host>
<endpoint address=""
binding="netTcpBinding"
bindingConfiguration="TransactionalBinding"
contract="myContract" />
<endpoint address="mex"
binding="mexTcpBinding"
contract="IMetadataExchange" />
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="TransactionalBinding"
transferMode="Streamed" transactionFlow="true" maxReceivedMessageSize="1000000000">
<readerQuotas maxDepth="10000" maxStringContentLength="1000000000"
maxArrayLength="1000000000" maxBytesPerRead="10000" maxNameTableCharCount="10000" />
<security mode="Transport" />
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="TransfertServiceBehavior">
<serviceMetadata httpGetEnabled="False"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceAuthorization impersonateCallerForAllOperations="true" />
</behavior>
</serviceBehaviors>
</behaviors>
클라이언트 응용 프로그램의 구성은 다음과 같습니다
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_Client" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="true" transferMode="Streamed" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="1000000000"
maxBufferSize="1000000000" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="1000000000"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:8095/MyNamespace.MyService"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_Client"
contract="myContract" behaviorConfiguration="ImpersonationBehavior">
<identity>
<userPrincipalName value="[email protected]" />
</identity>
</endpoint>
</client>
<behaviors>
<endpointBehaviors>
<behavior name="ImpersonationBehavior">
<clientCredentials>
<windows allowedImpersonationLevel="Impersonation" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
고마워요! 그것은 매우 도움이됩니다. 이것은 최고의 보안을 위해이를 수행하는 방법입니다. –