.NET Core MVC EF SQL Login Failure

  • Thread starter Thread starter Mke HammerFish
  • Start date Start date
M

Mke HammerFish

Guest
Hello,



I’m trying out a .NET Core MVC app using EF, and unable to get past a login failure.



Microsoft Visual Studio Community 2019 - Version : 16.4.0



  1. Loaded in the following: (Note I have tried other versions and no change, same issues).



Install-Package Microsoft.EntityFrameworkCore.SqlServer -Version 3.0.1



Install-Package Microsoft.EntityFrameworkCore.Sqlite



  1. I build a .NET Core MVC app, using Windows Auth.
  2. Compile the app
  3. Run the app, which prompts me for my credentials.
  4. The web site comes up just fine.



I then…



  1. Add a Model called Status, nothing special.



using System;

using System.Collections.Generic;

using System.Linq;

using System.Threading.Tasks;

using System.ComponentModel.DataAnnotations;



namespace ProtoMvcCoreAuthWindows.Models

{

public class Status

{

[Key]

public virtual Int64 StatusId { get; set; }



[StringLength(64)]

public virtual string StatusName { get; set; }



public virtual bool LogicalDelete { get; set; }

}

}



  1. And then create a controller, just the default settings.
  2. Compile the project with no errors.

Ok, time to run the project.

Browser asks for my credentials

  1. The web site comes up
  2. I hit the site calling the Status stuff - https://localhost:44357/Status, and I get the following error.



SqlException: Cannot open database "ProtoMvcCoreAuthWindowsContext-5c96112b-eb8e-48df-8207-fa7aaa28ae54" requested by the login. The login failed. Login failed for user 'WINNETKA\JoeDeveloper'.



  1. Note: I am an admin on the SQL Server, able to run all of my other non-core MVC apps with no problems, etc.



  • I have tried different MVC core prototypes, using different EF versions, different authentication methods, and always get some form of a login failure.



  • I have tried all of the examples found on various sites, and none of them work.



My questions are…



  1. Where am I supposed to check to find out why my program is failing on with a SQL login?



  1. Any ideas on possible next steps?



  1. Is there a pointer to a complete MVC Core EF example that I can download and run that will work without any additional modifications. As I have said before, I haven’t been able to find one that is able to just compile and run.



Thank you for any information you might have, it will be greatly appreciated.



Richard Loba

Continue reading...
 
Back
Top