The service ‘xxx’ configured for WCF is not registered with the Autofac container
2015-09-17 13:25
2381 查看
最近在使用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.
原:
改:
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(); } }
相关文章推荐
- .NET基础--Contains用法
- Raising Bacteria
- 百度mall首探(百度商城http://mall.baidu.com)
- Send email from dynamics ax
- LeetCode219:Contains Duplicate II
- ECSHOP后台SQL查询提示错误 this sql May contain UPDATE,DELETE,TRUNCATE,ALTER,DROP,FLUSH,INSERT
- 采用UltraISO制作U菜Win7安装盘,显现"File not find /BOOT/CDMENU.EZB.ezb"错误
- hdu 4750 Count The Pairs(并查集+二分)
- 深入理解mybaits数据源与连接池
- conversion to dalvik format failed with error 1。
- dig 命令 LINUX http://blog.csdn.net/zavens/article/details/3179121
- assign、retain、copy使用异同
- CF 579A Raising Bacteria
- leetcode:Contains Duplicate III
- AIX .tgz的安装包及登录日志查看
- Email正则表达式日常整理大全
- 使用Jmai发送邮件
- Container With Most Water 解答
- [CareerCup] 9.1 Climbing Staircase 爬楼梯
- cf#320 Div.2 Problem A Raising Bacteria