21

I am working on AngularJs application with node.js. Using gulp, I have created (compiled) my application (app in below image) and got the following directories

enter image description here

Now I completely struck how to proceed next. I want to host this application over IIS to run and see the pages (in views folder) but I don't know how to host it on IIS.

I tried this article, but it guides to use express server.

The issue is, how IIS will figure out that the first page lies in views folder, and even if I use the complete url

http://localhost:8078/views/index.html

it shows me all angular code with brackets like {{logginuser}} etc

EDIT: Do I need web.config file here or not. If yes then how I will define entry point to the application?

5
  • You need set as start page to you main screen (like index.html) Commented Sep 22, 2015 at 14:28
  • How can I set it in IIS? Commented Sep 22, 2015 at 14:30
  • See my answer for How can I set it in IIS? :) Commented Sep 22, 2015 at 14:31
  • far too little known about what build process you have set up in gulp. What resource paths are used when you load that url? Why are you opening views directory and not root? Commented Sep 22, 2015 at 14:38
  • @charlietfl: app is my destination folder where gulp copies minified files. And this app is running on wampserver perfectly but I don't know how to deploy it over iis Commented Sep 22, 2015 at 14:43

3 Answers 3

33

Just have to configure a Web Application under a website in IIS and create a custom web.config.

  1. In IIS, go to the Default Web Site, right-click and select Add Web Application
  2. Set the Alias to be AngularApp and the Physical Path to be the root of your directory
  3. Add a web.config file at the root of the directory with the following code

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
        <defaultDocument>
            <files>
                <add value="views/index.html" />
            </files>
        </defaultDocument>
      </system.webServer>
    </configuration>
    
  4. Browse to your new Angular application by going to http://localhost/AngularApp (assuming http binding in IIS).

Sign up to request clarification or add additional context in comments.

1 Comment

When I do this, my app breaks because it doesn't found the other resouces anymore. Any tips about it?
15

Lost 2 hours with this The solution was to go to WINDOWS FEATURES and check 'static content', under COMMON HTTP features.

enter image description here

Hope this helps someone.

Comments

3

You need set as start page to you main screen (like index.html)

How can I set it in IIS?

Just go to web.config file and add following

<system.webServer>
    <defaultDocument>
      <files>
        <clear />
        <add value="index.html" />//Path of your Page
      </files>
    </defaultDocument>
</system.webServer>

More details : How do I set the default page of my application in IIS7?

3 Comments

This is an angularJs application, and as I told that if I browse the page with complete url, it doesn't solve the angularJs conventions.
I browsed to http://localhost:8078/views/home.html and it showed me {{Title}}, instead of showing Hellow World Application.
No console error. actually the above configuration didn't work. I manually changed the url.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.