找不到請求的 .Net Framework 數據提供程序。它可能沒有安裝
完成 ASP.NET MVC 3 教程(在此處查找)後,我嘗試線上發布該應用程序。我聯繫了託管公司以確定是否可以託管 MVC 3 應用程序。我不得不 bin 部署(dll 文件)應用程序。因此,在hanselmans blog上執行了一些步驟後,我陷入了以下錯誤:
找不到請求的 .Net Framework 數據提供程序。它可能沒有安裝。說明:執行目前 Web 請求期間發生未處理的異常。請查看堆棧跟踪以獲取有關錯誤及其源自程式碼的位置的更多資訊。
異常詳細資訊:System.ArgumentException:找不到請求的 .Net Framework 數據提供程序。它可能沒有安裝。
源錯誤:
在執行目前 Web 請求期間生成了未處理的異常。可以使用下面的異常堆棧跟踪來辨識有關異常起源和位置的資訊。
堆棧跟踪:
$$ 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.InternalSet1.get_InternalContext() +15 System.Data.Entity.Infrastructure.DbQuery1.System.Linq.IQueryable.get_Provider() +37 System.Linq.Queryable.OrderByDescending(IQueryable1 源,表達式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, IDictionary2 參數)+188System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 參數) +27
任何幫助表示讚賞。
根據我的經驗,該錯誤意味著
providerNameweb.config 中連接字元串上的屬性值不正確,或者未安裝提供程序。如果您providerName設置為System.Data.SqlServerCe.4.0(SQL Server Compact),這在開發中並不少見,我可以向您保證它沒有安裝在您的 Web 主機上;它僅在 Visual Studio 中用於開發。您可能只需要將其更改為真正的 SQL Server 提供程序:System.Data.SqlClient.