An exception of type 'System.ArgumentException' occurred in Microsoft.EntityFrameworkCore.dll but was not handled in user code

asp.net-core asp.net-core-mvc entity-framework-core

Question

Error Occured in _context.userAccount.ToList()

An exception of type 'System.ArgumentException' occurred in Microsoft.EntityFrameworkCore.dll but was not handled in user code

Additional information: Format of the initialization string does not conform to specification starting at index 48.

OurDbContext.cs

public class OurDbContext : DbContext
    {
        public OurDbContext(DbContextOptions<OurDbContext> options) : base(options)
        {
        }
        public DbSet<UserAccount> userAccount { get; set; }
    }

HomeController.cs

private OurDbContext _context;
public HomeController(OurDbContext context)
{
     _context = context;
}

public IActionResult Index()
{
     return View(_context.userAccount.ToList());
}
1
0
1/31/2017 2:43:40 AM

Accepted Answer

Do check the connection string in your config file and make sure that there is no special character that should be escaped, like any termination or any such character in your connection string.

0
1/31/2017 2:48:12 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow