MVC 4 Web Application Tutorial – Create a Local IIS Site – First part – Step 3

So far we have been looking at our HTML files directly from the browser, through the file system.; The goal was to show that a server is not needed, as it is the browser which interpret and run, not only the HTML tags, but also CSS and even the Javascript code. But using HTML this way is not veryhandy, nor useful. So, before going further, let’s see how to create a local IIS site (Internet Information Server), this Web server being a module of Windows (7 and 8). If it’s not installed on your machine, you can do so from the Programs and Features (Add/Remove Programs) console, Turn Windows Features On or Off option on the left column.

There are different ways to create a local site on your machine. The one I am going to describe now is adapted to what we have been doing , manually create statics html and css files.

-1- Create a Virtual Directory in IIS

TutorialCreateWebSiteDirectory

In IIS Manager main windows, select the Default Web Site, then right click to get the popup menu. Select “Add Virtual Directory”. Give it an alias name, then select the actual physical path where your files are.

-2- Modify the Directory Security settings to allow the “Internet User” to read and execute scripts.

TutorialCreateWebSiteSecurity

IIS_IUSRS is the name given by the system to your Internet Guest. You need to give him rights as seen on the picture, in order to allow him to access your site content.

-3- Rename your file to match a default file name. Otherwise we would have to  lower server security to allow to browse the directory.

TutorialCreateWebSiteErrorNoBrowing

The file used in previous steps was named something like ““HTMLPartOneStepTwo.html”. This named is not known from IIS, and as I did not want to type this exact name as part of the URL, IIS do not allow us to browse the directory, even if IIS_USERS is allowed to. Standard ISS configuration disallow this feature. As you may seen on the screen shot, ISS kindly explain to us what we need to do to allow this feature, but it’s not a very good idea for quite obvious security reasons. In our (very simple) case, to see our page “served” by the server, we simply rename it “Index.html”.

-4- Point your browser to the local Url

TutorialCreateWebSiteErrorPageServerdFromBrowser

After this filename change, I just had to refresh the page to see it apprear, exactly identical as she was at the end of the previous step. The only difference being that, this time we get it through the Internet Server rather than through the file system. As this is totally static HTML, there is no other difference.

First Part Conclusion

As we have now seen what happens on the Browser side, we are finally ready to start working server side, that is beging with MVC and code.

If you have not yet done so, I invite you to subscribe to our email updates, so that you will be informed as soon as a new post is made.

Posted in ASP.NET MVC 4.0

Leave a Reply

Your email address will not be published. Required fields are marked *

*

NewsLetter

On Site Search

Custom search