In the previous post, we discuss how to create web service in asp.net using c#. In this post, we are going to discuss how to host a web service in IIS. Follow the below steps to publish the web service in IIS.
Step 1: Open IIS manager
Step 2: Add application
Right-click on ‘Default Website’, select ‘Add Application’: Enter Alias name as ‘MyFirstWebService’ and select the physical path as the path where the web service we created resides.
Step 3: Browse Service.asmx file
Click on MyFirstWebService application we created and change it to ‘Content View’. Right-click on ‘Service.asmx’ file and select Browse. You could see the below screen where the list of operations available in the service we created will be rendered for testing purposes.
Step 4: Test web service
It’s time to test the service we created, click ‘sayHello’ operation. It will open a web page the web method invocation can be done. Enter the name in the Name textbox and click invoke button. It will open up a new window where the response will be rendered as XML.