在IIS上部署angular度应用程序
我正在使用node.js处理AngularJs应用程序。 使用gulp,我已经创build(编译)我的应用程序(下图中的应用app
),并获得以下目录
现在我彻底打开了接下来的工作。 我想通过IIS托pipe这个应用程序来运行并查看页面(在views
文件夹中),但我不知道如何在IIS上托pipe它。
我试过这篇文章,但它指导使用快递服务器。
问题是,如何IIS会弄清楚,第一页位于views
文件夹,即使我使用完整的url
http://localhost:8078/views/index.html
它显示了所有angular度代码{{logginuser}}
等括号
编辑:我需要web.config文件或不。 如果是,那么我将如何定义应用程序的入口点?
只需在IIS中的网站下configuration一个Web应用程序,并创build一个自定义的web.config。
- 在IIS中,转到默认网站,右键单击并select添加Web应用程序
- 将Alias设置为AngularApp,将物理path设置为您的目录的根目录
-
使用以下代码在目录的根目录添加一个web.config文件
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <defaultDocument> <files> <add value="views/index.html" /> </files> </defaultDocument> </system.webServer> </configuration>
-
通过转到http:// localhost / AngularApp (假设在IIS中绑定http)浏览到您的新Angular应用程序。
用这个失去了2个小时解决scheme是去WINDOWS FEATURES
并检查“静态内容”下COMMON HTTP
function。
希望这有助于某人。
你需要设置为首页给你的主屏幕(如index.html)
我怎样才能在IIS中设置它?
只需转到web.config文件并添加以下内容
<system.webServer> <defaultDocument> <files> <clear /> <add value="index.html" />//Path of your Page </files> </defaultDocument> </system.webServer>
更多细节: 如何在IIS7中设置我的应用程序的默认页面?