角度cli + Windows身份验证后端
我创建了一个Angular CLI项目,其中包含对我的后端项目的代理引用,该后端项目包含Web api服务.
I created an Angular CLI project with a proxy reference to my backend project that contains the web api services.
launchSettings.json(后端项目):
launchSettings.json (backend project):
...
"iisSettings": {
"windowsAuthentication": true,
"anonymousAuthentication": false,
"iisExpress": {
"applicationUrl": "http://localhost:10863/",
"sslPort": 0
}
},
...
proxy.conf.json(前端项目):
proxy.conf.json (frontend project):
{
"/api": {
"target": "http://localhost:10863",
"secure": false,
"logLevel": "debug"
}
}
package.json(前端项目):
package.json (frontend project):
...
"scripts": {
"ng": "ng",
"start": "start http://localhost:4200 && ng serve --proxy-config proxy.conf.json",
"build": "ng build --prod --output-path=..\\CoreTest\\wwwroot",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
...
然后我启动后端并通过运行npm start
启动Kestrel Web服务器.使用angular2服务,可以对其中一个后端服务进行http-get操作.由于后端服务在具有Windows身份验证的IISExpress中运行
(我需要Windows身份验证),出现401错误.
Then I fire up the back-end and launch the Kestrel webserver by running npm start
. With an angular2 service I do a http-get to one of the back-end services. Since back-end services run in IISExpress with Windows Authentication
(I want windows authentication), I get a 401 error.
我可以执行npm run build
并浏览到我的IISExpress URL并加载ng build发布的index.html,但是我想使用ng serve方法,因为ng serve在内存中工作,因此开发更加顺畅.
I could do npm run build
and browse to my IISExpress url and load the index.html as published by ng build but I would like to use the ng serve method since development is much smoother because ng serve works in-memory.
我的问题是:在开发过程中如何在Windows身份验证中使用Angular CLI?
My question is: how can I use Angular CLI with Windows Authentication during development?