Publishing Web Service on IIS using File System Method

Posted On February 18, 2018 by Krishna Bhanushali Posted in 

Introduction:

In this blog, we will have a look on how a web service can be published on IIS and made publicly available.

Description:

Publishing is the process to make an Application code suitable to host on the Server by merging DLLs and keeping only the required UI code.

The steps required for hosting a web Service to the Server are as follows:

Steps to be followed:

Step 1:
Create the Application in Visual Studio.

1. Click on New Project → Go to Visual Studio Tab → Click on Web → Select ASP.NET Web Application → Change the name of the project and set the location for the project → Click OK.

2. Select Empty template as we will write the code by our self and not use the existing code → Select Web API and make sure Host in cloud is unchecked as we will be hosting the web service on IIS → Click OK.

3. When you click OK, project will be created and you can make modifications as per your requirement. Add a controller and write the HTTP methods you want to call.

4. We will create an empty controller and add the required methods.

5. Add the methods and add the routing action required so we can call it from anywhere.

Step 2:
1. Right click on the project created and click Publish.

b. Select the Publish Target.

Select the option, where you want to save the published file. There are lot of options given by Visual Studio to save the published files, as shown below.

In the above image, we have seen there are many options listed to publish the application:

  • Microsoft Azure App Service: You need Azure subscription to use this option.
  • Import: This option is used to publish applications which is based on the predefined configuration files given by hosting provider, which will directly publish the files in your hosting provider environment.
  • Custom: Publish the application in your own machine location or FTF Server.
  • Microsoft Azure API apps: This option is used to publish REST API’s Services in Cloud.
  • Microsoft Azure virtual machine: This option is used to publish the Application in Microsoft virtual machine which requires an Azure subscription.

3. Create Custom profile and give the profile name as per your requirement and Click OK.

4. Choose Publish Method.

Now configure the created profile, which decides where and how to publish the files and select the Target location of your local system in which you want to store the published files, as shown below.

5. Choose Publish code type:

What type of code you want in production environment by choosing release or debug option, as shown below.

Debug: Choose this option when you want to debug your application after the hosting.

Release: Choose this option when you do not want to debug the Application after hosting and make the Application faster.

Click Next.

6. Preview the configuration:

Now click Publish option and watch the output Windows. You will get a message that your application is published successfully.

7. Now navigate to the target folder and see the published files, as shown below.

Conclusion:

We have seen our published code, which is used to host in IIS. I hope from all the preceding examples, we learned how to publish ASP.NET Web API Service in File system.


Share Story :

SEARCH BLOGS :

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange