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