Developer Guide to deploy the .Net Core Web API Application on IIS.
- Windows 10 Professional
- Microsoft Visual Studio Professional 2017
- Internet Information Services 10
Please follow step by step procedure to host the .Net Core Web API applications to IIS.
Windows desktop operating systems
Enable the IIS Management Console and World Wide Web Services.
-
Navigate to Control Panel > Programs > Programs and Features > Turn Windows features on or off (left side of the screen).
-
Open the Internet Information Services node.
-
Check all options for FTP Server.
-
Check all options for Web Management Tools.
-
Check all options for World Wide Web Services
-
Check the box for Internet Information Services Hostable Web Core.
-
Click OK and wait till the installation is over.
-
Restart the system.
Install the .NET Core Hosting Bundle on the hosting system. The bundle installs the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module.
-
Navigate to the .NET downloads page
-
Under .NET Core, select the Download .NET Core Runtime button next to the Run Apps label. The installer's executable contains the word "hosting" in the file name (for example, dotnet-hosting-2.1.2-win.exe).
-
Run the installer on the server.
-
Wait till the installation is over.
-
Once the installation is completed, either restart your system [Recommended]
(or)
run below commands in sequence in command prompt:
net stop was /y
net start w3svc
The first command will stop the World Wide Web publishing service and the second command will start the service again
-
Clone the Repository or Download the source code to local folder.
-
Build the Application.
-
Right-click on the AcceptSuiteService project and select Publish from the menu.
-
It will publish the application on the above-mentioned path.
-
Open IIS as Administrator.
-
Right click on sites and select “Add Website”.
-
Provide Site name and physical path to the app’s deployment folder(C:\inetpub\wwwroot\Publish)
-
Choose binding type https from the drop down and provide the port number.
-
Select SSL Certificate IIS Express Development Certificate from drop down.
-
Click OK.
-
choose the AcceptServiceWebsite Application Pool.
-
Right click on the Application Pool and select Basic settings from context menu.
-
In the Edit Application pool window, select .NET CLR version to “No Managed Code”.
Check if .Net Core Windows Server Hosting bundle is installed properly
-
Next step is to check whether the hosting bundle which we installed earlier is installed properly or not.
-
For this click on Modules(in IIS Manager) of your newly created website and search for AspNetCoreModule. If it is available, it indicates that IIS is now aware of how to run a .Net Core application
-
ASP.NET Core Module lets you run ASP.NET Core applications on IIS for what it’s good for i.e. security, manageability, and lots more
-
Go to Environment Variables.
-
Click on Environment Variables.
-
Add System Variables
https.useProxy
if https.useProxy is set to true need to provide the values for below system variables.
if https.useProxy is set to false need not provide the values for below system variables.
https.proxyHost
https.proxyHost value should be userproxy.visa.com
https.proxyPort
https.proxyPort value should be 443
https.proxyUsername
https.proxyUsername value should be Your NTUserName
https.proxyPassword
https.proxyPassword value should be Your NTPassword
-
Click OK.
For Instance we will verify one of the API Method Validate Customer.
URL: https://:/api/AcceptSuite/ValidateCustomer?apiLoginId=78BZ5Xprry&apiTransactionKey=8s2F95Q7brhHd7Tn&customerId=1813212446
- Sample Request URL
Validate Customer API: https://10.173.192.248:3030/api/AcceptSuite/ValidateCustomer?apiLoginId=78BZ5Xprry&apiTransactionKey=8s2F95Q7brhHd7Tn&customerId=1813212446
- Response : {"status":true,"successValue":"I00001 Successful.","errorMessage":null}