If you try to deploy your ASP.Net Core API files in your live IIS server and receive the following error: HTTP Error 500.19 - Internal Server Error . There are two possible issues that might possibly trigger this problem.
The first possible issue is you may not have installed .Net Core Windows Server Hosting Bundle. This is required and need to be installed on your server. You can download the required software by visiting the following URL.
Once the software has been installed properly, you may have to restart your IIS server.
The second possible issue could be related to permission issue. In your IIS application pool, check the application advanced settings by right click of the selected application pools and select Advanced Settings. See if the framework has been set to No Managed Code and the identity of the application pool has been set to ApplicationPoolIdentity. ASP.Net runs in a separate process and does not rely on loading the CLR. So there is no need to set the .Net CLR version.
Once this is setup correctly, go to your site folder and make sure the permission of the folder grants the user access for the application pool user. The following is an example of screenshot if we have a site and application pool named: local.coreapi.com
Click the edit button and it will popup a window box for you to add a new username or group.Then click the add button.
Enter "IIS AppPool\DefaultAppPool" in the "Enter the object names to select:" text box. (Don't forget to change "DefaultAppPool" here to whatever you named your application pool.)
If this is your first time creating ASP.Net Core Web API, I would highly recommend to check out my article about creating your First ASP.Net Core WebAPI. I have included some explanations and images so you can easily follow the tutorial.
If you have any question or issue, feel free to post your comment or question below.