'Publishing and hosting Web API developed in .net core through IIS
I have WEB API developed in .net core (VS 2017). I need to deploy this api in IIS. This is the procedure I have followed.
- Open VS 2017, open the project -> right click on API , click on Publish.
- Selected File System -> Give a path where binaries where to be placed-> Click on Publish button.
After it is finished, there are some files in the physical path. I have copied the files on to the server where it is supposed to be hosted.
In the server, this is what I have done:
- Installed .Net core run time.
- Opened IIS , right click on default website -> Add Application -> Give name of application (say ABC) -> give physical path (where binaries are copied)-> Click OK.
There is a simple Get method in the API for now, where it just returns a string.
Say if the IP address of the server is 10.1.1.1 , this is the URL I'm using.
http://10.1.1.1/ABC/api/GetData
I'm trying this through Postman. I'm getting 500 Internal server error.
When I follow the same process for Web API developed in .Net framework, it is working perfectly fine.
Is there any step which I'm missing for .net core?
Solution 1:[1]
You need to ensure the following:
- .NET core hosting bundle is installed on the server
- Your application pool .NET CLR version is set to “No Managed Code”
For details check https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mohsin Mehmood |