4

當試圖訪問我的數據庫的實時Web應用程序,我得到的錯誤:配置錯誤 - 無法識別的屬性「名稱」/無法找到請求的.Net Framework數據提供程序。它可能沒有安裝

Server Error in '/' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unrecognized attribute 'name'.

Source Error:

An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Source File: C:\home\site\wwwroot\web.config Line: 115

我的web配置,其中線路115位於:

<entityFramework> 
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> 
    <parameters> 
    <parameter value="mssqllocaldb" /> 
    </parameters> 
</defaultConnectionFactory> 
<providers> 
    <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> 
    <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider> 
</providers> 
</entityFramework> 
<system.data> 
<DbProviderFactories> 
    <remove invariant="MySql.Data.MySqlClient" name="MySQL Data Provider" /> // Line: 115 
    <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> 
    <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /></DbProviderFactories> 
</system.data> 

當我刪除: name="MySQL Data Provider"從那一行開始,我只是得到另一個錯誤,並繞着圈子走。

此外,當我刷新頁面,並刪除部分name我得到:

Unable to find the requested .Net Framework Data Provider. It may not be installed.

任何幫助是極大的讚賞。

+0

您可以登錄到數據庫,你的'roomauditsystem'和'omitted' manyally? –

+0

爲什麼你有'add name = ...'兩個條目? –

+0

@GertArnold我不知道,我以爲自己知道自己在做什麼,但是我在很多圈子裏走來走去,我迷惑了自己。在安裝不同的軟件包之後,我想我結束了一個較老的版本,所以我相信我可以刪除第一個'add name = ...'。 – James

回答

1

8小時後,我設法解決了這個問題。出於某種原因,在NuGet包管理器中它說我已經安裝的版本是版本= 6.9.9.0,所以我說:

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

到我的web.config,但它仍然沒有工作,我都試過了,重新安裝等等等等,然後最終我進入我的bin文件夾,實際版本是6.8.3.0,但NuGet顯示6.9.9.0 - 奇怪!

我從bin文件夾中刪除了這些文件,然後重新安裝了最新的版本,它一切正常!

2

我有一個非常類似的問題,沒有任何工作對我來說。我通過將.NET框架版本更改爲4.5而不是4.5.2來修復它。看看這個article.

+0

感謝您的輸入,但我仍然收到相同的錯誤! – James

+0

看看你的'異常堆棧跟蹤'後,我想你的應用程序無法訪問服務器上的數據庫。請檢查兩次你的連接字符串到處 –

0

我覺得這個名字不能包含空格,你也有兩個名稱相同的數據供應商,以便您的代碼應該是這樣的:

<add name="MySQLDataProvider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> 
    <add name="MySQLDataProvider2" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /></DbProviderFactories> 
相關問題