Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9143481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:02:15+00:00 2026-06-17T10:02:15+00:00

I have a problem with MySql and Entity Framework Code First. My Connection String

  • 0

I have a problem with MySql and Entity Framework Code First.

My Connection String at the web.config.xml

<add name="EntityContext" connectionString="Server=127.0.0.1; port=8080 Database=simple_crud; Uid=root; Pwd=;" providerName="MySql.Data.MySqlClient" />

My Context:

public class EntityContext : DbContext
{
    public DbSet<Pessoa> Pessoas { get; set; }
}

My Class:

[Table("pessoa")]
public class Pessoa
{
    [Key]
    [Column("Id")]
    public int Id { get; set; }

    [Column("Nome")]
    public string Nome { get; set; }
}

My Controller

public EntityContext db = new EntityContext();

public ActionResult Index()
{
     List<Pessoa> pessoas = db.Pessoas.ToList(); // here is the error
     return View(pessoas);
}

So, when I press F5 I got this: “Input string was not in a correct format”.

What I’m miss?

UPDATE

Stack Trace:

[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options,
NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
+9591147 System.Number.ParseUInt32(String value, NumberStyles options, NumberFormatInfo numfmt) +119
System.String.System.IConvertible.ToUInt32(IFormatProvider provider)
+46 System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) +9509065
MySql.Data.MySqlClient.MySqlConnectionStringBuilder.ChangeType(Object
value, Type t) +240
MySql.Data.MySqlClient.MySqlConnectionStringBuilder.SetValue(String
keyword, Object value) +399
MySql.Data.MySqlClient.MySqlConnectionStringBuilder.set_Item(String
keyword, Object value) +54
System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String
value) +127
MySql.Data.MySqlClient.MySqlConnection.set_ConnectionString(String
value) +289
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String
name) +409
System.Data.Entity.Internal.LazyInternalConnection.Initialize() +49
System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel()
+10 System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
+265 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type
entityType) +17
System.Data.Entity.Internal.Linq.InternalSet1.Initialize() +62
System.Data.Entity.Internal.Linq.InternalSet
1.GetEnumerator() +15
System.Data.Entity.Infrastructure.DbQuery1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator()
+40 System.Collections.Generic.List
1..ctor(IEnumerable1 collection) +315 System.Linq.Enumerable.ToList(IEnumerable1
source) +58 SimpleMysqlCrud.Controllers.PessoaController.Index() in
f:\users\pablo.rocha.fti\documents\visual studio
2010\Projects\SimpleMysqlCrud\SimpleMysqlCrud\Controllers\PessoaController.cs:16
lambda_method(Closure , ControllerBase , Object[] ) +62
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase
controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary2 parameters) +208
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext, ActionDescriptor actionDescriptor, IDictionary
2
parameters) +27
System.Web.Mvc.<>c_DisplayClass15.b_12()
+55 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter
filter, ActionExecutingContext preContext, Func1 continuation) +263
System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14()
+19 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext
controllerContext, IList
1 filters, ActionDescriptor actionDescriptor,
IDictionary2 parameters) +191
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext
controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
+97 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext
requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8
1.b__7(IAsyncResult
) +12 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.<>c_DisplayClasse.b_d() +50
System.Web.Mvc.SecurityUtil.b
_0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action)
+22 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult
result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+8970141 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:02:16+00:00Added an answer on June 17, 2026 at 10:02 am

    Gathering all comments into answer.

    Add semicolon after port=3306; and check your mysql listening port (maybe 3306, mysql default?). Resulting connection string:

    <add name="EntityContext" connectionString="Server=127.0.0.1; port=3306; Database=simple_crud; Uid=root; Pwd=;" providerName="MySql.Data.MySqlClient" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I having a weird problem with Entity Framework with MySql database. Here's the code
I have a problem inserting a row using Entity Framework with the MySQL Connector/NET
I have got a native join sub query problem in MySQL Entity. SQL code
I am new the code-first Entity Framework. I have tried a few things now,
I have problem with entity framework and mysql. I have solved entity framework function
I am using CakePHP framework with MySQL database and I have problem in saving
I have a simple entity, Code, that I need to persist to a MySQL
I'm learning ASP.NET MVC 3 with Entity Framework Code First. I'm following a tutorial
I have a WPF application in which I use entity framework with mysql connector/net
I have a problem with Entity Framework. It's really slow to refresh the model

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.