2013-04-23 38 views
6

完成了ASP.NET MVC 3(找到here)后,我试着在网上发布的应用程序。我联系了托管公司,以确定是否有可能托管MVC 3应用程序。但我不得不部署(dll文件)应用程序。所以下面就hanselmans blog一些步骤后,我被陷在以下错误:无法找到请求的.Net Framework数据提供程序。它可能没有安装

Unable to find the requested .Net Framework Data Provider. It may not be installed. 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.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.]
System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1420503
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name) +362
System.Data.Entity.Internal.LazyInternalConnection.Initialize() +49
System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel() +10 System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +265 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +17
System.Data.Entity.Internal.Linq.InternalSet 1.Initialize() +62
System.Data.Entity.Internal.Linq.InternalSet
1.get_InternalContext() +15 System.Data.Entity.Infrastructure.DbQuery 1.System.Linq.IQueryable.get_Provider() +37 System.Linq.Queryable.OrderByDescending(IQueryable 1 source, Expression 1 keySelector) +66
MvcMusicStore.Controllers.HomeController.GetTopSellingAlbums(Int32 count) +420 MvcMusicStore.Controllers.HomeController.Index() +47
lambda_method(Closure , ControllerBase , Object[]) +40
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary
2 parameters) +188
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27

任何帮助表示赞赏。

+0

你在使用实体框架吗? – mattytommo 2013-04-23 09:49:03

+0

是的,这正是教程中提到的。 – SamekaTV 2013-04-23 14:08:02

+1

您是否已将Copy Local = True添加到实体框架参考? – mattytommo 2013-04-23 14:13:09

回答

11

根据我的经验,这个错误意味着你的web.config中连接字符串的providerName属性值不正确,或者提供者字面上没有安装。如果您providerName设置为System.Data.SqlServerCe.4.0(SQL Server精简),这是并不鲜见的发展,我可以向你保证,这不是你的虚拟主机上安装;它只在Visual Studio中用于开发。您可能只需要将其更改为真正的SQL Server提供程序:System.Data.SqlClient

+1

验证您的连接字符串,以确保服务器名称和身份验证信息是正确的。 – 2013-04-23 15:57:19

2

我解决了这个问题。

我找到的providerName的空间。因此.net框架无法建立与数据库的连接字符串。

检查您的connectionString标记属性值。 您的providerName可能没有很好的定义。 不允许在providerName值中包含任何空格和chack额外字符。

0

我面对类似的问题..并没有为该很有趣的解决方案..只要看着你的ConnectionString - 如果是相同的,你已经使用了你的其他ASP.Net应用程序,那么它不应该。 ..实体框架都有不同的情况下,完全

<add name="EmployeeContext" connectionString="Server=.\SQLEXPRESS;Database=DB1;User Id=user1;password=password1;" providerName="System.Data.SqlClient**;**" /> 

将其更改为 -

<add name="EmployeeContext" connectionString="Server=.\SQLEXPRESS;Database=DB1;User Id=user1;password=password1;" providerName="System.Data.SqlClient"/> 

你能找出差别..只是一个小 - 有没有“;”在提供者名称的末尾.. 是的,这使得区别..它应该与提供者名称的同一副本相同,但我没有检查区分大小写。但是,解决我的问题

0

另一个数据点...

我与甲骨文和实体框架工作。我安装了Oracle ODP.NET,Managed Driver来解决这个问题。在NuGet包管理器中输入

Install-Package Oracle.ManagedDataAccess 

它将使用相应的程序集信息和DbProviderFactory更新App.config。我正在使用VS 2015,Entity Framework 6.我也安装了Oracle Developer Tools。

+0

Hi @Jeff。我在IIS 8.5中部署站点时目前面临同样的问题。你可以检查这个http://stackoverflow.com/q/42090440/1839005。欣赏你的宝贵建议。 – bkr 2017-02-08 12:00:08

0

错误是完美的,上面的意见是好的,但在我的情况下,我从字面上拼写错误提供商在web.config文件:System.Data.SqlClinet没有System.Data.SqlClient的

相关问题