“/”应用程序中的服务器错误。

The type Database cannot be constructed. You must configure the container to supply this value.

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.InvalidOperationException: The type Database cannot be constructed. You must configure the container to supply this value.

源错误:

执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。

堆栈跟踪:


[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) +204
   Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.PreBuildUp(IBuilderContext context) +217
   Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +320
   Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlanCreatorPolicy.CreatePlan(IBuilderContext context, NamedTypeBuildKey buildKey) +174
   Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) +237
   Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +320
   Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) +447

[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) +547
   Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides) +20
   Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +54

[ActivationException: Activation error occured while trying to get instance of type Database, key ""]
   Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +155
   Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance() +54
   DBUtility.DbHelper..ctor() in e:\WebProject\集团网\DBUtility\DbHelper.cs:17
   DBUtility.SqlDbHelper..ctor() in e:\WebProject\集团网\DBUtility\SqlDbHelper.cs:11
   FrameWork.BaseClass..cctor() in e:\WebProject\集团网\FrameWork\BaseClass.cs:50

[TypeInitializationException: “FrameWork.BaseClass”的类型初始值设定项引发异常。]
   FrameWork.NewsManage.GetInfo(String id) in e:\WebProject\集团网\FrameWork\NewsManage.cs:55
   Second.Web.View.Page_Load(Object sender, EventArgs e) in d:\WebProject\www.disha.cn\Second.Web\View.aspx.cs:44
   System.Web.UI.Control.OnLoad(EventArgs e) +106
   System.Web.UI.Control.LoadRecursive() +68
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3785


版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.7.3535.0