0

I have programmed a very basic API using ASP.NET Core 6.0 and using Entity Framework Core I am trying to communicate with one of my SQL Server databases to access a table.

When I run my IIS Express profile locally on my machine, the API endpoint works and I'm able to retrieve back JSON. But when I publish it to my IIS Server and configure it appropriately I try hitting the same endpoint, I get an HTTP 500 internal server error instead.

I don't really have experience with server management so it leads me to believe it's a server configuration error.

I have tried various troubleshooting methods like deleting the website and uploading it again, changing the application pool and the port number, I made sure the database connection I'm using to speak to the SQL Server, the credentials I'm using has access to read and write to the database and it works perfectly fine locally.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Resacky
  • 11

1 Answers1

0

I have found a resolution to my issue. So it turns out I needed to either, modify my application pool's identity within my IIS server, where I am hosting my ASP.NET Core Web API project OR I could configure the SQL Database where I'm adding a new user in the form of "IIS AppPool\IIS app pool name".

I have decided to simply change the application pool's identity since the latter would require SQL database configuration and I wasn't confident on that front but it seems the root of the issue stems from invalid credentials within the integrated pipeline used to have the API controller speak to the Database.

I will link the two related stackoverflow forms I have used for guidance: https://stackoverflow.com/a/40068398/21147756 https://stackoverflow.com/a/62677997/21147756

And this is a video with the proper timestamp that explains in more detail on the first IIS AppPool suggestion: https://youtu.be/PdsgiiLzQ18?t=1435

Resacky
  • 11