1. 程式人生 > >MVC: 找不到請求的 .Net Framework Data Provider。可能沒有安裝

MVC: 找不到請求的 .Net Framework Data Provider。可能沒有安裝

遇到這個問題,我是下載SQL Server Compact 4.0 安裝後就可以解決。下載地址是:

在尋找解決辦法的時候還找到一個學習MVC的例子,MVC music store  http://mvcmusicstore.codeplex.com/ 我現在學習的例子是ContosoUniversity

在尋找解決方法時,找到幾個解答,在這裡收集起來。

在C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG中machine.config(xml檔案)中有一個欄位是<DbProviderFactories>

添加註冊,<name= "SqlClient Data Provider">或者<name="MySQL Data Provider"

<system.data>

    <DbProviderFactories>

      <add name="Odbc Data Provider" invariant="System.Data.Odbc" description=".Net Framework Data Provider for Odbc" type="System.Data.Odbc.OdbcFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

      <add name="OleDb Data Provider" invariant="System.Data.OleDb" description=".Net Framework Data Provider for OleDb" type="System.Data.OleDb.OleDbFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

      <add name="OracleClient Data Provider" invariant="System.Data.OracleClient" description=".Net Framework Data Provider for Oracle" type="System.Data.OracleClient.OracleClientFactory, System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

      <add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

      <add name="SQL Server CE Data Provider" invariant="Microsoft.SqlServerCe.Client" description=".NET Framework Data Provider for Microsoft SQL Server 2005 Mobile Edition" type="Microsoft.SqlServerCe.Client.SqlCeClientFactory, Microsoft.SqlServerCe.Client, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />

     <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL"type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=5.0.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

<add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

    </DbProviderFactories>

</system.data>

在最後面我想新增一些MVC開發需要安裝的軟體,

Before you start, make sure you have the following software installed on your computer:
Visual Studio 2010 SP1 or Visual Web Developer Express 2010 SP1 (If you use one of these links, the following items will be installed automatically.)
 ASP.NET MVC 3 Tools Update
 Microsoft SQL Server Compact 4.0
 Microsoft Visual Studio 2010 SP1 Tools for SQL Server Compact 4.0