【发布时间】:2019-05-17 12:43:39
【问题描述】:
我遵循this 策略在同一个 Azure Web 应用中部署 Angular 应用和 Web api。
我在 VS 2017 中使用 VSCode 和 Web Api 进行 Angular 应用程序开发。所以它不是像 VS 2017 中的 Angular 应用程序模板中的完整应用程序
我用
部署了 web apiservices.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "ClientApp/dist";
});
和
app.UseSpa(spa =>
{
spa.Options.SourcePath = "ClientApp";
});
已将 Angular 应用程序的构建版本复制到 Azure Web 应用程序上的 ClientApp/dist 文件夹。将 azure 应用的 WEBSITE_NODE_DEFAULT_VERSION 设置为 10.14.1,那里可用。
但是当我浏览网站时,我在浏览器控制台中收到错误 -
SyntaxError: expected expression, got '<'[Learn More] runtime.js:1
SyntaxError: expected expression, got '<'[Learn More] polyfills.js:1
SyntaxError: expected expression, got '<'[Learn More] styles.js:1
SyntaxError: expected expression, got '<'[Learn More] scripts.js:1
SyntaxError: expected expression, got '<'[Learn More] vendor.js:1
SyntaxError: expected expression, got '<'[Learn More] main.js:1
我看到了,所有请求都获取 index.html 而不是实际的 .js 文件。
似乎带有节点的角度应用程序没有启动。
【问题讨论】:
标签: node.js angular azure asp.net-core azure-web-app-service