简体   繁体   中英

Why does my Angular site return a directory when published to IIS?

I have been attempting to publish an Angular app to a Windows server using IIS. When the site opens, it returns a directory rather than the site itself. If I click on index.html, the site displays as expected.

What am I doing wrong?

屏幕截图(网站、index.html、web.config)

To help others who have this issue. I would like to post the answer here.

When we deploy angular application in IIS, no handler is required. When means extensionless request will not be handled automatically. So we use default document to specify the application entry and then rewrite no file no directory URL to this entry.

This is how we deploy angular js in IIS.

extension less URL=>rewrite => /=> default document=>index.html.

So both URL rewrite and default document should be required. And you won't lose out on any feature.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM