Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Asp.net Core IIS Deployment Database

$
0
0

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!


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>