2010-07-21 2 views
0

사용자 자격 증명 (이것은 감사 트리거 등으로 인해 클라이언트/dba 요구 사항)을 사용하여 Entity Framework를 통해 SQL 서버에 액세스하는 WCF 웹 서비스를 통해 노출하려고 시도하고 있습니다. 사용자의 자격 증명을 사용하지 마십시오.)WCF를 사용하여 가장

가장을 구현하는 데 WCF를 사용하는 데 문제가 있습니다. (실제로 그것은 악몽이었다). 내 계약에

[OperationBehavior(Impersonation = ImpersonationOption.Allowed)] 

속성을 추가했습니다. 그런 다음 BasicHttpContract가 Window Impersonation을 수행 할 수 없다는 불만을 제기했습니다. wsHttpBinding으로 변경하려고했습니다. 이제 메타 데이터 교환이 중단되었습니다. 지금까지 나는 인터넷 익스플로러에서만 서비스를 열려고하고 있으며 아직 클라이언트와 연결을 시작하지 않았습니다.

<behaviors> 
    <serviceBehaviors> 
    <behavior name="AssetManagerBehavior"> 
     <serviceAuthorization impersonateCallerForAllOperations="true" /> 
     <!-- 
     --> 
     <!-- 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="true" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 

    <services> 
     <service name="AssetManager.ServiceInterface" behaviorConfiguration="AssetManagerBehavior"> 
      <endpoint address="" binding="wsHttpBinding" contract="IAssetServices"> 
      </endpoint> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     </service> 
    </services> 

<bindings> 
    <wsHttpBinding> 
    <binding name="test"> 
     <security mode="TransportWithMessageCredential" /> 
    </binding> 
    </wsHttpBinding> 
</bindings> 

아래 관련 서비스 인터페이스 클래스는 그래서 실제 구현 내가 2010 VS를 사용하고이

namespace AssetManager.ServiceInterface 
{ 
public class AssetManagerServices : IAssetServices 
{ 

    #region IAssetServices Members 

    [OperationBehavior(Impersonation = ImpersonationOption.Allowed)] 
    public EmployeeDTO CreateNewEmployee(string firstName, string lastName) 
    { 
    } 
} 
} 

과 같은

namespace AssetManager.ServiceInterface 
{ 
[ServiceContract] 
public interface IAssetServices 
    { 
     [OperationContract] 
     EmployeeDTO CreateNewEmployee(string firstName, string lastName); 
    } 
} 

보이는처럼의 Web.config의 관련 섹션 본다 .net 4, IIS 7 (익명, ASP.NET 가장, 기본 인증, 다이제스트 인증 및 Windows 인증). IIS의 루트 웹 서버에서 ISAPI 및 CGI 제한을 클릭하고 모든 확장에 대한 액세스를 허용했습니다 (asp.net 4.0은 아마도 relavent 중 하나 일 것입니다).

현재의 장애물은 "이 서비스에 대한 메타 데이터 게시는 다음과 같습니다. 현재 비활성화 "IE에서 위치를 탐색 할 때. 또한 서비스 참조를 추가 할 수 없습니다.

마지막 메모로서 분명히 Windows 위장을 수행하는 것이 어렵지 않을 것입니다. WCF를 사용하여 웹 서비스에 가장 (impersonation)을 수행하는 방법은 무엇입니까? asp.net 세계에서 그것은 <authentication mode="Windows"/><identity impersonate="true"/>

답변

0

을 추가하는 것만 큼 간단합니다. 전송 수준 보안을 사용하는 경우 http가 아닌 https 프로토콜을 사용하게됩니다.

당신은

<serviceMetadata httpsGetEnabled=true /> 

을 (당신은 단지 httpGetEnabled를) 설정해야합니다.

+0

아니요, 작동하지 않습니다. 이제 "이 서비스에 대한 보안 설정에 '익명'인증이 필요합니다."예외가 발생했습니다. IIS에서 익명 인증을 해제하여 클라이언트 가장을 얻습니다. 이 작업을 수행 할 수있는 유일한 방법은 wsBinding을 basicBinding으로 변경하고 사용하는 것입니다. 하지만 이제는 내 프런트 엔드 프로젝트에 대한 서비스 참조는 "메타 데이터에 인증되지 않은 익명의 http 요청을 해결할 수없는 참조가 포함되어 있습니다"라는 오류가 발생하기 때문에 – Chaitanya

관련 문제