2012-09-27 4 views
0

wcf 및 예 약 아키텍처를 사용하는 응용 프로그램과 함께 작업 중이므로 데이터베이스에 쓸 서비스를 만들려고합니다. 여기 내 서비스는 다음과 같습니다 (Sicaf.Core.Services.Wcf)을 ComponentRegistrar.cs에서샤프 아키텍처를 사용하는 WCF - ServiceLocator에서 유형의 필요한 종속성을 찾을 수 없습니다.

[ServiceContract] 
public interface IFacturaWcfService : ICloseableAndAbortable 
{   
    [OperationContract] 
    string ConsultarValorMatricula(string xmlData); 
} 
[ServiceBehavior, AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] 
    public class FacturaWcfService : IFacturaWcfService 
    { 
     private readonly IFacturaBusiness facturaBusiness; 

     public FacturaWcfService(IFacturaBusiness facturaBusiness) 
     { 
      this.facturaBusiness = facturaBusiness; 
     } 

     public string ConsultarValorMatricula() 
     { 
      return facturaBusiness.GetFactura(); 
     } 

     public void Abort() { } 

     public void Close() { } 
    } 

: 나는 클라이언트를 생성

private static void AddWcfServicesTo(IWindsorContainer container) 
     { 
      // Since the TerritoriesService.svc must be associated with a concrete class, 
      // we must register the concrete implementation here as the service    
      container.AddComponent("facturaWcfService", typeof(FacturaWcfService)); 
     } 

(Sicaf.Core.Services.WebServices) 그러나 나는이 예외를 얻는다 :

The needed dependency of type FacturaWcfService could not be located with the ServiceLocator. You'll need to register it with the Common Service Locator (CSL) via your IoC's CSL adapter. 

답변

0

나는 마침내 나의 실수를 발견했다.

전 :

private static void AddCustomRepositoriesTo(IWindsorContainer container) 
     { 
      // Register Data Layer Services 
      container.Register(
       AllTypes.Pick() 
       .FromAssemblyNamed("Sicaf.Core.Services.Data") 
       .WithService.FirstNonGenericCoreInterface("Sicaf.Core.Services.Services.Data"));     
     } 

후 :

private static void AddCustomRepositoriesTo(IWindsorContainer container) 
     { 
      // Register Data Layer Services 
      container.Register(
       AllTypes.Pick() 
       .FromAssemblyNamed("Sicaf.Core.Services.Data") 
       .WithService.FirstNonGenericCoreInterface("Sicaf.Core.Services.Services.Data")); 

      container.Register(
       AllTypes.Pick() 
       .FromAssemblyNamed("SismatV2.Data") 
       .WithService.FirstNonGenericCoreInterface("SismatV2.Services.Data")); 
     }