I created an Angular CLI project with a proxy reference to my backend project that contains the web api services.
launchSettings.json (backend project):
...
"iisSettings": {
"windowsAuthentication": true,
"anonymousAuthentication": false,
"iisExpress": {
"applicationUrl": "http://localhost:10863/",
"sslPort": 0
}
},
...
proxy.conf.json (frontend project):
{
"/api": {
"target": "http://localhost:10863",
"secure": false,
"logLevel": "debug"
}
}
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"
},
...
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.
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.
My question is: how can I use Angular CLI with Windows Authentication during development?