本文介绍了Angular 6代理不再起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Angular应用程序和一个Web API.要在本地进行测试,我使用一个代理配置文件:proxy.conf.json
I have an angular application and one web api. To test is locally, I use a proxy config file: proxy.conf.json
{
"/api": {
"target": {
"host": "localhost",
"protocol": "http:",
"port": 50565
},
"secure": false,
"changeOrigin": false,
"logLevel": "info"
}
}
一切正常.最近我更新到ng6.从那时起,我得到以下错误:
Everything was working fine. Recently I updated to ng6. Since then I get the following error:
[HPM]尝试将请求/api/data/GetCurrentUser/从localhost:4200代理到 http://localhost时发生错误:50565 (ECONNREFUSED)
[HPM] Error occurred while trying to proxy request /api/data/GetCurrentUser/ from localhost:4200 to http://localhost:50565 (ECONNREFUSED)
你知道这里发生了什么吗? (我使用ng serve --proxy-config proxy.conf.json)
Any idea what's going on here? (I use ng serve --proxy-config proxy.conf.json)
推荐答案
请尝试
这篇关于Angular 6代理不再起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!