【发布时间】:2011-06-21 20:08:28
【问题描述】:
我有一个带有实体框架数据项目和 MVC 网站的 Visual Studio 2010 解决方案。调试时,该网站在 IDE 中运行良好,但在 IIS 中部署到它自己的站点(甚至是我的本地 IIS 实例)时,它在任何访问提供程序的视图中都会失败。 CNR.HARPS.DATA 是带有 .edmx 文件的数据项目。我只是不明白为什么它可以在 IDE 中工作,但在 IIS 本身中运行时却不行。
[ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.]
System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +251
[ArgumentException: The specified store provider cannot be found in the configuration, or is not valid.]
System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +10983191
System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +641
System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) +84
CNR.HARPS.ENTITIES.HARPSDataModel..ctor() in D:\GAP.CONVERSION\CNR.HARPS\Dev\CNR.HARPS\CNR.HARPS.DATA\HARPS.Context.cs:23
CNR.HARPS.DATA.FeeOwnerRepository..ctor() in D:\GAP.CONVERSION\CNR.HARPS\Dev\CNR.HARPS\CNR.HARPS.DATA\Repositories\FeeOwnerRepository.cs:22
CNR.HARPS.WEB.CONTROLLERS.FeeOwnerController..ctor() in D:\GAP.CONVERSION\CNR.HARPS\Dev\CNR.HARPS\CNR.HARPS.WEB\Controllers\FeeOwnerController.cs:31
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +117
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +247
System.Activator.CreateInstance(Type type, Boolean nonPublic) +106
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +84
【问题讨论】:
-
您使用的是什么提供商? SQLCE?
-
你在使用 SQLite 吗?在这种情况下,您可能缺少对数据库提供程序工厂的引用。
-
请贴出连接字符串
-
这里是连接字符串:
当在 cassini Web 服务器而不是 IIS 7 中运行时,此字符串工作正常,该应用程序工作正常。
标签: .net asp.net-mvc-3 entity-framework-4