//以下两个注册,在Unity中是默认的
//注册控制器,否则不管接口注入还是属性注入都获取不到服务实例
Builder.RegisterControllers(typeof(MvcApplication).Assembly);
//这句可支持属性注入
//Builder.RegisterControllers(Assembly.GetExecutingAssembly()).PropertiesAutowired();
Container = Builder.Build();
System.Web.Mvc.DependencyResolver.SetResolver(new AutofacDependencyResolver(Container));//MVC特有的