0

私は、wcf とシャープ アーキテクチャを使用するアプリケーションを使用しています。データベースに書き込むサービスを作成しようとしています。これが私のサービスです: (Sicaf.Core.Services.Wcf)

[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() { }
    }

ComponentRegistrar.cs: (Sicaf.Core.Services.WebServices)

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));
        }

クライアントを作成しましたが、次の例外が発生します。

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.
4

1 に答える 1

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"));
        }
于 2012-09-28T17:07:21.220 に答える