I can not connect to the database (local). Mistake: 
Ошибка сервера в приложении '/'. Методу "MySql.Data.MySqlClient.MySqlProviderServices.GetDbProviderManifestToken(System.Data.Common.DbConnection)" не удалось получить доступ к методу "MySql.Data.MySqlClient.MySqlConnection.get_Settings()". Описание: Необработанное исключение при выполнении текущего веб-запроса. Изучите трассировку стека для получения дополнительных сведений о данной ошибке и о вызвавшем ее фрагменте кода. Сведения об исключении: System.MethodAccessException: Методу "MySql.Data.MySqlClient.MySqlProviderServices.GetDbProviderManifestToken(System.Data.Common.DbConnection)" не удалось получить доступ к методу "MySql.Data.MySqlClient.MySqlConnection.get_Settings()". Stack trace:
[MethodAccessException: Методу "MySql.Data.MySqlClient.MySqlProviderServices.GetDbProviderManifestToken(System.Data.Common.DbConnection)" не удалось получить доступ к методу "MySql.Data.MySqlClient.MySqlConnection.get_Settings()".] MySql.Data.MySqlClient.MySqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +44 System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +87 [ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.] System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +271 MySql.Data.Entity.MySqlManifestTokenResolver.ResolveManifestToken(DbConnection connection) +32 System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +56 System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +43 System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +62 System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +123 System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +627 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +18 System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +53 System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator() +15 System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator() +53 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +375 System.Linq.Enumerable.ToList(IEnumerable`1 source) +58 WebApplication2.Controllers.HomeController.Index() in C:\Users\shebanits.vitaliy\source\repos\WebApplication2\WebApplication2\Controllers\HomeController.cs:24 lambda_method(Closure , ControllerBase , Object[] ) +62 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +157 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27 System.Web.Mvc.Async.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22 System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32 System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__11_0() +50 System.Web.Mvc.Async.<>c__DisplayClass11_1.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +228 System.Web.Mvc.Async.<>c__DisplayClass7_0.<BeginInvokeActionMethodWithFilters>b__1(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34 System.Web.Mvc.Async.<>c__DisplayClass3_6.<BeginInvokeAction>b__3() +35 System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__5(IAsyncResult asyncResult) +100 System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27 System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +11 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +45 System.Web.Mvc.<>c.<BeginExecute>b__151_2(IAsyncResult asyncResult, Controller controller) +13 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10 System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +28 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9748665 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +159 I understand that you can not connect to the database, but I do not understand what the error is, tell me. Here is the code ...
web.config
<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6"> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> <providers> <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /> </providers> </entityFramework> <connectionStrings> <add name="conn" providerName="MySql.Data.MySqlClient" connectionString="server=127.0.0.1;uid=root;Password=Accessdeniedroma2005;database=musicportal;CharSet=utf8;Persist Security Info=False;Integrated Security=true" /> </connectionStrings> Model with context:
using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Web; namespace WebApplication2.Models { public class User { public int id { get; set; } public string login { get; set; } public string password { get; set; } public string username { get; set; } } [DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))] public class UsersContext : DbContext { public UsersContext() : base("conn") { } public DbSet<User> Users { get; set; } } } and part of the controller:
private UsersContext dbUsers = new UsersContext(); public ActionResult Index() { //string connectionString = @"Data Source=localhost; Database = musicportal; User ID = root; Password = Accessdeniedroma2005;SslMode=none"; //using (MySqlConnection cn = new MySqlConnection(connectionString)) //{ // cn.Open(); // Response.Write("Подключился!"); //} return View(dbUsers.Users.ToList()); }
"conn"and"server=127.0.0.1;uid=root;Password=Accessdeniedroma2005;database=musicportal;CharSet=utf8;Persist Security Info=False;Integrated Security=true"ie . Your connection, and comment out one of the lines, if there is an error, comment another. If it helps, then maybe my solution will help. - nick_n_a