更换了代建配置的ng build angular 2项目

时间:2017-08-29 01:58:41

标签: angular iis asp.net-web-api deployment build

根据http://www.meekdeveloper.com/angular-cli-asp-net-core-windows-authentication/中的建议,我使用代理配置从Angular 2调用ASP.NET Web API

ng serve --proxy-config src/proxy.config.js

代理配置如下:

    const Agent = require('agentkeepalive');

module.exports = {  
        '/api': {
            target: 'http://localhost/ApplicationApi/',
            secure: false,
            agent: new Agent({
                maxSockets: 100,
                keepAlive: true,
                maxFreeSockets: 10,
                keepAliveMsecs: 100000,
                timeout: 6000000,
                keepAliveTimeout: 90000
            }),
            onProxyRes: proxyRes => {
                let key = 'www-authenticate';
                proxyRes.headers[key] = proxyRes.headers[key] &&
                    proxyRes.headers[key].split(',');
            }
        }
};

它适用于开发,但ng-build没有代理配置参数。

我想将应用程序部署到IIS中,如何在不更改源代码的情况下保留URL前缀(http://localhost/ApplicationApi/)?

0 个答案:

没有答案