Why can Entity Framework code connect to SQL express in IIS Express but not on IIS?

940 Views Asked by At

I have a .Net core application that uses Entity Framework and SQL express running all running on the same machine.In debug mode from within Visual Studio 2019, i.e. IIS Express, I can read/write to the database no problem.

However, when I deploy to IIS also running on the same machine, any View which has a controller using Entity Framework returns a 404.

optionsBuilder.UseSqlServer("Server=.\\SQLExpress;Database=MyDB;Trusted_Connection=True;");

I'm assuming it's a privilages issue but using Trusted_Connection I'm not sure which account needs the privileges. Is it the admin account in windows 10? Do I need a special user account for ISS?

When I take away any code that uses EF, the 404 disappears so I'm certain it's a SQL server related issue.

Thanks, Ian

0

There are 0 best solutions below