0
雖然我的應用程序在本地運行正常,我有困難的時候將其部署到蔚藍色的Web應用程序。如何定義Azure的部署web.config文件以獲得平均的應用?
的應用程序的結構如下:
- ./index.html
- ./app.js - 主要的node.js代碼,包括快速中間件
- ./*.js - 支持MYAPP的Node.js的代碼
- ./assets/angular - Angular.js v1.2.x
- ./assets/bootstrap
- ./assets/css
- ./assets/img
- ./views - 視圖用於應用
- state.js路由/ MyApp的/ *(例如,/ MyApp的/家,/ MyApp的/登錄)。
- 所有快遞API調用來/ API/*(例如,/ API /版)
從其他來源的花絮拼湊之後,一個web.config我最好的猜測是:
<handlers>
<!-- Indicates that the app.js file is a node.js site to be handled by the iisnode module -->
<add name="iisnode" path="app.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<!-- Do not interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^app.js\/debug[\/]?" />
</rule>
<rule name="Static files" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<!-- Core application files -->
<add input="{REQUEST_URI}" pattern="assets/" ignoreCase="true" />
<add input="{REQUEST_URI}" pattern="views/" ignoreCase="true" />
</conditions>
<action type="Rewrite" url="{REQUEST_URI}" />
</rule>
<rule name="Express.js API">
<match url="api/*" />
<action type="Rewrite" url="app.js"/>
</rule>
<rule name="Angular">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.html" />
</rule>
</rules>
</rewrite>
不幸的是,發佈到Azure的,而大部分的資產和/ index.html文件被加載(如在瀏覽器調試窗口中查看)之後,我得到一個「無法加載資源:服務器按照500的狀態迴應(內部服務器錯誤)「/assets/angular/app.js。
這可能是造成這個問題?此外,在Azure上部署MEAN應用程序是否有標準?這種類型的MEAN應用是否有標準的web.config?
看到的問題,如果[這些步驟](https://github.com/projectkudu/kudu/wiki /疑難解答 - 節點錯誤)可幫助診斷問題。 –
它說:「應用程序已拋出一個未捕獲的異常,並終止: ReferenceError:myapp沒有在對象。(D:\ home \ site \ wwwroot \ assets \ angular \ state.js:2:1) (1)定義應用程序的assets/angular/app.js沒有運行(2)index.html的行 wasn' t理解(我懷疑),或者(3)在assets/angular/angularjs /中沒有運行本身 –
HiDefLoLife