2013-04-23 79 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的

相關問題