|
Configuring IIS for Web Service Hosting
Next, let do some tweaking on the IIS side so that we can access the web service directly through the normal access using browser. Launch the Internet Information Services.
We can see the project folder in the IIS snap-in however we need to create a virtual directory to map it to the physical path. |
Create a new virtual directory.
You can use the following alias if you want. Click the Next button.
Click the Browse button to browse the project physical path.
Make sure you select the first level project folder which host all the files and folders. Click the OK button.
The correct physical path is shown in the following Figure.
Just click the Next button for the access permission. We need to select the third check box if we need to run executable such as the DLL. Previously, the DLL was loaded and run using the ISAPI or CGI however in this case we can use the Web.config file to achieve the same purpose.
Click the Finish button.
Now we can see the virtual directory that map to the real physical path. Next, open the Properties page for our Default Web Site. We need to tweak some more settings.
Click the Home Directory property page. We need to point to the real physical local path. Click the browse button.
Select the first level project path as done in the virtual directory setup.
|
|
Now you can see the Local Path of the content. Then, click the Documents property page.
We need to enable the default document, because the web service file name to be run has different file name and extension in this case. Click the Add button.
Type the file name of the web service application. In this case it is Service1.asmx. Click the OK button.
Then move the document to the top position.
Meanwhile, if the ASP .NET was configured properly, you can see the ASP .NET property page in the ASP .NET property page as shown below.
Click the OK button to close and save all the new settings. Select the object that will be inherited by the previous settings. In this case Printers is not relevant, just click the OK button.
Next, restart IIS.
Then, let test the IIS web server (locally and physically).
You can see the web service test page displayed on the right window as if you are accessing it through a normal browser.
Please remember that the permission used in this local web access is Integrated Windows Authentication which can be seen through the Directory Security property page. Non-local and non-physical access should use the Anonymous access for normal web access. From the Directory Security web site property page, click the Edit button.
The you can select several authentication schemes used for the web site. As mentioned before, non-local and non-physical access should use the Anonymous access.
You may want to test the web service at this stage.
Next, let access the web service using browser as a normal web user. Launch your browser, use http://localhost/ or http://127.0.0.1 as the URL. Well, all looks fine now.
You may want to test float values for the Sum method. Exception will be thrown and displayed in the browser. You can set the debugging info for ASP through the Home Directory property page > Configuration button > Debugging page. This is very useful method in debugging the ASP web application.