Hi folks,
I have created Aps.net Core 2 with Angular template project by default project type.
And I have added Context Data, Connection String and another controller file called PersonController.cs as below:
[Route("api/[controller]")] [EnableCors("CorsPolicy")] public class PersonDataController : Controller { private readonly PersonDBContext _context; public PersonDataController(PersonDBContext context) { _context = context; } [HttpGet("[action]")] public IEnumerable<PersonInfo> Persons() { return _context.PersonInfos; } }
In Sql Server Management Studio (SSMS):
In Postman:
It seems good. Now I have created a new site from IIS (localhost/bpa/webapi).
For Weather Data (Non-database):
For Person Data (Database):
I do not understand why i am not getting person data. My Connection string is as below:
"ConnectionStrings": { //"PersonConnection": "Server=(localdb)\\mssqllocaldb;Database=PersonDB;Trusted_Connection=True;""PersonConnection": "Server=(localdb)\\mssqllocaldb;Database=PersonDB;User ID=sa; Password=********;" },
What am I missing? Any Idea?
I am waiting for your response.
Thanks in advance!