我有一个项目是在安装了 MVC3 的机器上开发的。我将项目复制到同时安装了 3 MVC 和 MVC4 的机器上。出于某种原因,我收到以下错误。MVC3 和 MVC4 应该能够并排运行。我认为该错误与安装 MVC4 有关,因为成员资格提供程序在 3 和 4 之间更改。我不确定如何隔离问题。在安装了 MVC3 和 MVC4 的开发机器上运行 MVC3 项目时,如何解决 ConfigurationErrorsException?
System.Configuration.ConfigurationErrorsException was unhandled by user code
Message=Exception has been thrown by the target of an invocation. (C:\Projects\Acme\BOM&MRP\AcmeWidget\Acme.Widget.Web\web.config line 42)
Source=System.Web
BareMessage=Exception has been thrown by the target of an invocation.
Filename=C:\Projects\Acme\BOM&MRP\AcmeWidget\Acme.Widget.Web\web.config
Line=42
StackTrace:
at System.Web.Security.Membership.Initialize()
at System.Web.Security.Membership.get_Provider()
InnerException: System.Reflection.TargetInvocationException
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Web.HttpRuntime.CreatePublicInstance(Type type)
at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)
InnerException: System.NullReferenceException
Message=Object reference not set to an instance of an object.
Source=Acme.Widget.DAL
StackTrace:
at Acme.Widget.DAL.Utilities.GetRegistryValue(String registryKeyPath, String valueName) in C:\Projects\Acme\BOM&MRP\AcmeWidget\Acme.Widget.DAL\Utilities.cs:line 67
at Acme.Widget.DAL.Utilities.GetConnectionString() in C:\Projects\Acme\BOM&MRP\AcmeWidget\Acme.Widget.DAL\Utilities.cs:line 15
at Acme.Widget.DAL.StoredProcedureRepository..ctor() in C:\Projects\Acme\BOM&MRP\AcmeWidget\Acme.Widget.DAL\StoredProcedureRepository.cs:line 21
at Acme.Widget.Provider.Membership..ctor() in C:\Projects\Acme\BOM&MRP\AcmeWidget\Acme.Widget.Provider\Membership.cs:line 18
InnerException:
提前致谢。