且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

配置错误 - 无法识别的属性名称/无法找到所请求的.Net框架数据提供程序。它可能没有安装

更新时间:2022-10-14 21:04:54

8小时后,我设法解决了这个问题。由于某些原因,在NuGet软件包管理器中,我说我安装的版本是Version = 6.9.9.0,所以我补充说:

  ; add name =MySQL Data Providerinvariant =MySql.Data.MySqlClientdescription =.Net Framework Data Provider for MySQLtype =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文件夹,然后重新安装最新版本,一切正常!


When trying to access my database in a live web application I get the error:

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

My web config where line 115 is located:

<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>

When I remove: name="MySQL Data Provider" from that line, I just get another error and go around in circles.

Also when I refresh the page and remove that name part I get:

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

Any help is greatly appreciated.

After 8 hours I managed to solve this. For some reason, in NuGet Package Manager it said the version I had installed was Version=6.9.9.0 so I added:

<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" />

to my web.config and yet it still didn't work, I tried everything, reinstalling, etc. etc. and then eventually I went into my bin folder and the actual version there was 6.8.3.0 yet NuGet displayed 6.9.9.0 - strange!

I deleted these from the bin folder and then reinstalled the latest version and it all worked!