<?xml version = "1.0" encoding = "utf-8"?>
<configuration>
<configSections>
<sectionGroup name = "dotNetOpenAuth" type = "DotNetOpenAuth.Configuration.DotNetOpenAuthSection, DotNetOpenAuth.Core">
<section name = "messaging" type = "DotNetOpenAuth.Configuration.MessagingElement, DotNetOpenAuth.Core" requirePermission = "false" allowLocation = "true" />
<section name = "reporting" type = "DotNetOpenAuth.Configuration.ReportingElement, DotNetOpenAuth.Core" requirePermission = "false" allowLocation = "true" />
<section name = "oauth" type = "DotNetOpenAuth.Configuration.OAuthElement, DotNetOpenAuth.OAuth" requirePermission = "false" allowLocation = "true" />
<section name = "openid" type = "DotNetOpenAuth.Configuration.OpenIdElement, DotNetOpenAuth.OpenId" requirePermission = "false" allowLocation = "true" />
</sectionGroup>
</configSections>
<!--For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 </configSections>
<configuration>
<configSections>
<section name = "quartz" type = "System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name = "log4net" type = "log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<sectionGroup name = "common">
<section name = "logging" type = "Common.Logging.ConfigurationSectionHandler, Common.Logging" />
<section name = "entityFramework" type = "System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission = "false" />
</sectionGroup>
</configSections>-->
<system.web>
<compilation debug = "true" targetFramework = "4.5">
<assemblies>
<add assembly = "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly = "System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<httpRuntime targetFramework = "4.5" />
</system.web>
<connectionStrings>
<add name = "StarterSite" connectionString = "Data Source=|DataDirectory|\StarterSite.sdf" providerName = "System.Data.SqlServerCe.4.0" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns = "urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name = "DotNetOpenAuth.Core" publicKeyToken = "2780ccd10d57b246" />
<bindingRedirect oldVersion = "0.0.0.0-4.3.0.0" newVersion = "4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name = "DotNetOpenAuth.AspNet" publicKeyToken = "2780ccd10d57b246" />
<bindingRedirect oldVersion = "0.0.0.0-4.3.0.0" newVersion = "4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name = "System.Web.Optimization" publicKeyToken = "31bf3856ad364e35" />
<bindingRedirect oldVersion = "1.0.0.0-1.1.0.0" newVersion = "1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name = "WebGrease" publicKeyToken = "31bf3856ad364e35" />
<bindingRedirect oldVersion = "0.0.0.0-1.6.5135.21930" newVersion = "1.6.5135.21930" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name = "System.Web.Helpers" publicKeyToken = "31bf3856ad364e35" />
<bindingRedirect oldVersion = "1.0.0.0-3.0.0.0" newVersion = "3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name = "System.Web.WebPages" publicKeyToken = "31bf3856ad364e35" />
<bindingRedirect oldVersion = "1.0.0.0-3.0.0.0" newVersion = "3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name = "MySql.Data" publicKeyToken = "c5687fc88969c44d" culture = "neutral" />
<bindingRedirect oldVersion = "0.0.0.0-6.8.8.0" newVersion = "6.8.8.0" />
</dependentAssembly>
</assemblyBinding>
<!-- This prevents the Windows Event Log from frequently logging that HMAC1 is being used (when the other party needs it). -->
<legacyHMACWarning enabled = "0" />
<!-- When targeting ASP.NET MVC 3, this assemblyBinding makes MVC 1 and 2 references relink
to MVC 3 so libraries such as DotNetOpenAuth that compile against MVC 1 will work with it.
<assemblyBinding xmlns = "urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name = "System.Web.Mvc" publicKeyToken = "31bf3856ad364e35" />
<bindingRedirect oldVersion = "1.0.0.0-3.0.0.0" newVersion = "3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
-->
</runtime>
<system.data>
<DbProviderFactories>
<remove invariant = "System.Data.SqlServerCe.4.0" />
<add name = "Microsoft SQL Server Compact Data Provider 4.0" invariant = "System.Data.SqlServerCe.4.0" description = ".NET Framework Data Provider for Microsoft SQL Server Compact" type = "System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
<remove invariant = "MySql.Data.MySqlClient" /><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.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /></DbProviderFactories>
</system.data>
<system.net>
<defaultProxy enabled = "true" />
<settings>
<!-- This setting causes .NET to check certificate revocation lists (CRL)
before trusting HTTPS certificates. But this setting tends to not
be allowed in shared hosting environments. -->
<!--<servicePointManager checkCertificateRevocationList = "true"/>-->
</settings>
</system.net>
<dotNetOpenAuth>
<messaging>
<untrustedWebRequest>
<whitelistHosts>
<!-- Uncomment to enable communication with localhost (should generally not activate in production!) -->
<!--<add name = "localhost" />-->
</whitelistHosts>
</untrustedWebRequest>
</messaging>
<!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. -->
<reporting enabled = "true" />
<!-- This is an optional configuration section where aspects of dotnetopenauth can be customized. -->
<!-- For a complete set of configuration options see http://www.dotnetopenauth.net/developers/code-snippets/configuration-options/ -->
<openid>
<relyingParty>
<security requireSsl = "false">
<!-- Uncomment the trustedProviders tag if your relying party should only accept positive assertions from a closed set of OpenID Providers. -->
<!--<trustedProviders rejectAssertionsFromUntrustedProviders = "true">
<add endpoint = "https://www.google.com/accounts/o8/ud" />
</trustedProviders>-->
</security>
<behaviors>
<!-- The following OPTIONAL behavior allows RPs to use SREG only, but be compatible
with OPs that use Attribute Exchange (in various formats). -->
<add type = "DotNetOpenAuth.OpenId.RelyingParty.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth.OpenId.RelyingParty" />
</behaviors>
</relyingParty>
</openid>
</dotNetOpenAuth>
<uri>
<!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names),
which is necessary for OpenID urls with unicode characters in the domain/host name.
It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. -->
<idn enabled = "All" />
<iriParsing enabled = "true" />
</uri>
<system.codedom>
<compilers>
<compiler language = "c#;cs;csharp" extension = ".cs" type = "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel = "4" compilerOptions = "/langversion:6 /nowarn:1659;1699;1701" />
<compiler language = "vb;vbs;visualbasic;vbscript" extension = ".vb" type = "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel = "4" compilerOptions = "/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
<entityFramework>
<providers>
<provider invariantName = "MySql.Data.MySqlClient" type = "MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</providers>
</entityFramework>
</configuration>
Я создал проект веб-страниц ASP.NET, а точнее Razor V3, и после первой сборки появилась следующая ошибка
Unrecognized configuration section entity Framework" \Web.config.I have tried installing Data.Entity from the nugget manager but it did not work.
(Severity Code Description Project File Line Suppression State Error
Unrecognized configuration section entityFramework.
C:\Users\HP\source\repos\VisitoMgtApp\VisitoMgtApp\Web.config 135
). Пожалуйста, помогите мне





Вам нужно переместить закомментированное определение раздела конфигурации entity framework в существующий элемент конфигурационных разделов следующим образом:
<?xml version = "1.0" encoding = "utf-8"?>
<configuration>
<configSections>
<!--This is your EF section definition that was added-->
<section name = "entityFramework" type = "System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission = "false" />
<sectionGroup name = "dotNetOpenAuth" type = "DotNetOpenAuth.Configuration.DotNetOpenAuthSection, DotNetOpenAuth.Core">
<section name = "messaging" type = "DotNetOpenAuth.Configuration.MessagingElement, DotNetOpenAuth.Core" requirePermission = "false" allowLocation = "true" />
<section name = "reporting" type = "DotNetOpenAuth.Configuration.ReportingElement, DotNetOpenAuth.Core" requirePermission = "false" allowLocation = "true" />
<section name = "oauth" type = "DotNetOpenAuth.Configuration.OAuthElement, DotNetOpenAuth.OAuth" requirePermission = "false" allowLocation = "true" />
<section name = "openid" type = "DotNetOpenAuth.Configuration.OpenIdElement, DotNetOpenAuth.OpenId" requirePermission = "false" allowLocation = "true" />
</sectionGroup>
</configSections>
<!--For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 </configSections>
<configuration>
<configSections>
<section name = "quartz" type = "System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name = "log4net" type = "log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<sectionGroup name = "common">
<section name = "logging" type = "Common.Logging.ConfigurationSectionHandler, Common.Logging" />
<section name = "entityFramework" type = "System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission = "false" />
</sectionGroup>
</configSections>-->
<system.web>
<compilation debug = "true" targetFramework = "4.5">
<assemblies>
<add assembly = "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly = "System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<httpRuntime targetFramework = "4.5" />
</system.web>
<connectionStrings>
<add name = "StarterSite" connectionString = "Data Source=|DataDirectory|\StarterSite.sdf" providerName = "System.Data.SqlServerCe.4.0" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns = "urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name = "DotNetOpenAuth.Core" publicKeyToken = "2780ccd10d57b246" />
<bindingRedirect oldVersion = "0.0.0.0-4.3.0.0" newVersion = "4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name = "DotNetOpenAuth.AspNet" publicKeyToken = "2780ccd10d57b246" />
<bindingRedirect oldVersion = "0.0.0.0-4.3.0.0" newVersion = "4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name = "System.Web.Optimization" publicKeyToken = "31bf3856ad364e35" />
<bindingRedirect oldVersion = "1.0.0.0-1.1.0.0" newVersion = "1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name = "WebGrease" publicKeyToken = "31bf3856ad364e35" />
<bindingRedirect oldVersion = "0.0.0.0-1.6.5135.21930" newVersion = "1.6.5135.21930" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name = "System.Web.Helpers" publicKeyToken = "31bf3856ad364e35" />
<bindingRedirect oldVersion = "1.0.0.0-3.0.0.0" newVersion = "3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name = "System.Web.WebPages" publicKeyToken = "31bf3856ad364e35" />
<bindingRedirect oldVersion = "1.0.0.0-3.0.0.0" newVersion = "3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name = "MySql.Data" publicKeyToken = "c5687fc88969c44d" culture = "neutral" />
<bindingRedirect oldVersion = "0.0.0.0-6.8.8.0" newVersion = "6.8.8.0" />
</dependentAssembly>
</assemblyBinding>
<!-- This prevents the Windows Event Log from frequently logging that HMAC1 is being used (when the other party needs it). -->
<legacyHMACWarning enabled = "0" />
<!-- When targeting ASP.NET MVC 3, this assemblyBinding makes MVC 1 and 2 references relink
to MVC 3 so libraries such as DotNetOpenAuth that compile against MVC 1 will work with it.
<assemblyBinding xmlns = "urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name = "System.Web.Mvc" publicKeyToken = "31bf3856ad364e35" />
<bindingRedirect oldVersion = "1.0.0.0-3.0.0.0" newVersion = "3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
-->
</runtime>
<system.data>
<DbProviderFactories>
<remove invariant = "System.Data.SqlServerCe.4.0" />
<add name = "Microsoft SQL Server Compact Data Provider 4.0" invariant = "System.Data.SqlServerCe.4.0" description = ".NET Framework Data Provider for Microsoft SQL Server Compact" type = "System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
<remove invariant = "MySql.Data.MySqlClient" /><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.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /></DbProviderFactories>
</system.data>
<system.net>
<defaultProxy enabled = "true" />
<settings>
<!-- This setting causes .NET to check certificate revocation lists (CRL)
before trusting HTTPS certificates. But this setting tends to not
be allowed in shared hosting environments. -->
<!--<servicePointManager checkCertificateRevocationList = "true"/>-->
</settings>
</system.net>
<dotNetOpenAuth>
<messaging>
<untrustedWebRequest>
<whitelistHosts>
<!-- Uncomment to enable communication with localhost (should generally not activate in production!) -->
<!--<add name = "localhost" />-->
</whitelistHosts>
</untrustedWebRequest>
</messaging>
<!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. -->
<reporting enabled = "true" />
<!-- This is an optional configuration section where aspects of dotnetopenauth can be customized. -->
<!-- For a complete set of configuration options see http://www.dotnetopenauth.net/developers/code-snippets/configuration-options/ -->
<openid>
<relyingParty>
<security requireSsl = "false">
<!-- Uncomment the trustedProviders tag if your relying party should only accept positive assertions from a closed set of OpenID Providers. -->
<!--<trustedProviders rejectAssertionsFromUntrustedProviders = "true">
<add endpoint = "https://www.google.com/accounts/o8/ud" />
</trustedProviders>-->
</security>
<behaviors>
<!-- The following OPTIONAL behavior allows RPs to use SREG only, but be compatible
with OPs that use Attribute Exchange (in various formats). -->
<add type = "DotNetOpenAuth.OpenId.RelyingParty.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth.OpenId.RelyingParty" />
</behaviors>
</relyingParty>
</openid>
</dotNetOpenAuth>
<uri>
<!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names),
which is necessary for OpenID urls with unicode characters in the domain/host name.
It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. -->
<idn enabled = "All" />
<iriParsing enabled = "true" />
</uri>
<system.codedom>
<compilers>
<compiler language = "c#;cs;csharp" extension = ".cs" type = "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel = "4" compilerOptions = "/langversion:6 /nowarn:1659;1699;1701" />
<compiler language = "vb;vbs;visualbasic;vbscript" extension = ".vb" type = "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel = "4" compilerOptions = "/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
<entityFramework>
<providers>
<provider invariantName = "MySql.Data.MySqlClient" type = "MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</providers>
</entityFramework>
</configuration>
Большое спасибо за ваш ответ
Ошибки, которые у меня сейчас есть; 1. Файл конфигурации web.config не имеет корневого тега <configuration>. 2. XML-документ не может содержать несколько элементов корневого уровня. 3. Элемент «пакеты» не объявлен. 4. Элемент dotNetOpenAuth не объявлен.
Я обновил свой ответ, включив в него полный код. Из вашего описания вы могли случайно удалить элемент <configuration>. Чтобы исправить это, сделайте резервную копию существующего файла конфигурации, откройте файл конфигурации, удалите все содержимое в файле конфигурации, скопируйте и вставьте мой ответ в файл конфигурации. Сохраните и снова запустите ваше приложение.
Я очень ценю вашу помощь.
Ошибка исчезла со следующей ошибкой: Код серьезности Описание Ошибка состояния подавления строки файла проекта Метод инициализации перед запуском приложения Start on type WebMatrix.WebData.PreApplicationStartCode вызвал исключение со следующим сообщением об ошибке: Не удалось загрузить файл или сборку MySql .ConnectorInstaller, Версия = 6.10.5.0, Культура = нейтральный, PublicKeyToken = c5687fc88969c44d 'или одна из его зависимостей. Система не может найти указанный файл. (C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Config \ machin e.config, строка 266).
И эта вторая ошибка: элемент «пакеты» не объявлен. VisitoMgtApp C: \ Users \ HP \ source \ repos \ VisitoMgtApp \ VisitoMgtApp \ packag es.config 2
ваше определение раздела конфигурации для EF закомментировано.