我正在使用Windows Azure移动服务的源代码控制功能来推送自定义API脚本。
我做了什么:
service/api/test.js
和service/api/test.json
文件(自定义API脚本和配置)。我从git得到以下输出:
remote: Updating branch 'master'.
remote: Updating submodules.
remote: Preparing deployment for commit id '1cbfbd5ac1'.
remote: Running custom deployment command...
remote: Running deployment command...
remote: Handling Basic Web Site deployment.
remote: KuduSync.NET from: 'D:\home\site\repository\service' to: 'D:\home\site\wwwroot\App_Data\config\scripts'
remote: Copying file: 'api\test.js'
remote: Copying file: 'api\test.json'
remote: Missing server.js/app.js files, web.config is not generated
remote: Node.js versions available on the platform are: 0.6.17, 0.6.20, 0.8.2, 0.8.19, 0.8.26, 0.10.5, 0.10.18, 0.10.21, 0.10.24.
remote: Selected node.js version 0.10.24. Use package.json file to choose a different version.
remote: npm WARN package.json [email protected] No repository field.
remote: npm WARN package.json [email protected] No README data
remote: Finished successfully.
remote: Deployment successful.
现在,当我尝试通过标准API访问任何现有表时(例如,发布到https://myservice.azure-mobile.net/tables/MyTable
),我将返回500 Internal Server Error。
我认为上面输出中的这一行与此有关:
remote: Missing server.js/app.js files, web.config is not generated
但是,从来没有任何东西server.js
或app.js
包含在git repo中,我也不知道这些文件应该包含什么,因为在文档中似乎没有提及这些文件。
原来,此错误消息不是罪魁祸首:
remote: Missing server.js/app.js files, web.config is not generated
像一个优秀的程序员一样,我将配置信息放置在中<PROJECT_ROOT>/shared/config.json
。当我检查日志时,它抱怨路由配置不正确。该文档暗示仅<PROJECT_ROOT>/api
包含自定义路由,因此当文档明确指出该共享目录专门用于表和自定义API脚本使用的共享代码时,我不知道为什么它将共享目录中的JSON文件解释为路由配置。
更改之后config.json
,以config.js
和进行必要的代码更改,这一切又开始工作。
我仍然收到有关缺少server.js / app.js文件的警告,但似乎没有任何影响。
结论:请勿将JSON文件添加到Azure移动服务脚本中,除非readme.md
最初与脚本捆绑在一起的文件中指定。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句