如何解决无法构造类型数据库。您必须配置容器以提供此值。 [英] how to solve The type Database cannot be constructed. You must configure the container to supply this value.

查看:190
本文介绍了如何解决无法构造类型数据库。您必须配置容器以提供此值。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨团队,

调试时,我收到此错误。如何解决。

Hi team,
While debugging ,i am getting this error .How to solve it .

 The type Database cannot be constructed. You must configure the container to supply this value.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The type Database cannot be constructed. You must configure the container to supply this value.

Source Error:

Line 471:            catch (Exception exception)
Line 472:            {
Line 473:                throw exception;
Line 474:            }
Line 475:            finally


Source File: G:\Quantum IndiaProjects\Code\Kaizen.Application\Kaizen.Application.2G\Kaizen.Application.2G.DataManagers\CombinedMasterDataManager.cs    Line: 473

Stack Trace:

[InvalidOperationException: The type Database cannot be constructed. You must configure the container to supply this value.]
   Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.GuardTypeIsNonPrimitive(IBuilderContext context, SelectedConstructor selectedConstructor) +159
   Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.PreBuildUp(IBuilderContext context) +132
   Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +185
   Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlanCreatorPolicy.CreatePlan(IBuilderContext context, NamedTypeBuildKey buildKey) +108
   Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) +137
   Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +185
   Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) +158

[ResolutionFailedException: Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Data.Database", name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type Database cannot be constructed. You must configure the container to supply this value.
-----------------------------------------------
At the time of the exception, the container was:

  Resolving Microsoft.Practices.EnterpriseLibrary.Data.Database,(none)
]
   Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) +322
   Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides) +15
   Microsoft.Practices.Unity.UnityServiceLocator.DoGetInstance(Type serviceType, String key) +39
   Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +42







请指导我..

谢谢

Harshal。




Please guide me ..
Thanks
Harshal.

推荐答案



请上传代码(可能是你的try块)。因为异常不在catch部分或异常堆栈中发生。

please upload the code(probably your try block). because the exception occurs not in the catch part or exception stack.


这篇关于如何解决无法构造类型数据库。您必须配置容器以提供此值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆