我们正在使用Azure Web App上托管的Angular 7网站。 该前端应用程序正在从后端服务器.net core 2.2中获取数据,并且该数据也托管在Azure Web App中。
所以有两个网址:
1)https://myangular.azurewebsites.net->对于前端角度网站 2)https://mywebapi.azurewebsites.net->对于后端Web api
如果我在浏览器https://mywebapi.azurewebsites.net/api/product/getlist中书写,则会返回json
现在我的有角度的网站正在调用网络api网址,它在http://localhost:4200和 https://mywebapi.azurewebsites.net/api/product/getlist
但是在托管于azure Web应用程序上后,调用Web API URL https://mywebapi.azurewebsites.net/api/product/getlist时抛出错误
错误:404:http失败响应:https://myangular.azurewebsites.net/mywebapi.azurewebsites.net/api/product/getlist
在这里,我注意到Web Api Url被基本URL覆盖,这就是为什么合并的azurewebsites正在调用并因此引发错误的原因。
任何人都知道如何在Angular 7中解决该问题