zoukankan      html  css  js  c++  java
  • The service ‘xxx’ configured for WCF is not registered with the Autofac container

    最近在使用autofac.wcf时,报如下异常:

    Exception Details: System.InvalidOperationException: The service 'xxx' configured for WCF is not registered with the Autofac container.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    原:

    public static class Initializer 
          {
                public static void Initialize()
                {
                      RegisterTypes();
                      Bootstrapper.With.AutoMapper().Start();
                }
    
                static void RegisterTypes()
                {
                      ContainerBuilder builder = new ContainerBuilder();
                      
                      builder.RegisterType<UnitOfWork>();
                      builder.RegisterType<PermissionDbContext>().As<IDbContext>();
                      builder.RegisterType<PermissionService>().As<IPermissionService>();
                      builder.RegisterType<UnitOfWork>().As<IUnitOfWork>();
                      AutofacHostFactory.Container = builder.Build();
                }
          }

    改:

    public static class Initializer 
          {
                public static void Initialize()
                {
                      RegisterTypes();
                      Bootstrapper.With.AutoMapper().Start();
                }
    
                static void RegisterTypes()
                {
                      ContainerBuilder builder = new ContainerBuilder();
                      builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly());
                      builder.RegisterType<UnitOfWork>();
                      builder.RegisterType<PermissionDbContext>().As<IDbContext>();
                      builder.RegisterType<PermissionService>().As<IPermissionService>();
                      builder.RegisterType<UnitOfWork>().As<IUnitOfWork>();
                      AutofacHostFactory.Container = builder.Build();
                }
          }
  • 相关阅读:
    原生js实现outerWidth()方法,用到getComputedStyle
    正则取数字
    关于JavaScript的各种width
    原生JavaScript根据类名获取元素
    通过DriveManager类实现数据库MySQL的连接
    org.apache.http.conn.HttpHostConnectException: Connection to xxx refused.
    C# 序列化原因 (转)
    C# 序列化理解 2(转)
    C# 序列化理解 1(转)
    C# using一般用法 (转)
  • 原文地址:https://www.cnblogs.com/yipeng-yu/p/4816107.html
Copyright © 2011-2022 走看看