我有现在的作品在节点的js我有一个Windows Server 2016年平均栈的应用程序和端口3000 ,我需要部署.NET应用程序,所以我需要IIS。 我无法在端口80上运行两个Web服务器,但我不希望用户被迫键入运行我的Mean应用程序的端口。 我试着用iisnode工作,但没有成功,我以80端口的请求重定向到另一个端口也读到反向代理。 这两种解决方案都可能是有效的,但是,在将其他时间花在错误的方向上之前,我会问在这种情况下最佳做法是什么。平均堆栈上安装端口80或或IIS下
UPDATE: 向前迈进了一小步。 我现在可以访问应用程序的加载页面,但应用程序无法找到我的bundle.js(由创建的WebPack包)。
module.exports = webpackMerge.smart(commonConfig, {
entry: {
'app': './assets/app/main.aot.ts'
},
output: {
path: path.resolve(__dirname + '/public/js/app'),
filename: 'bundle.js',
publicPath: '/js/app/',
chunkFilename: '[id].[hash].chunk.js'
},
我的web.config是:
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="start.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="tep">
<match url="/*" />
<action type="Rewrite" url="start.js" />
</rule>
</rules>
</rewrite>
<security>
<requestFiltering>
<hiddenSegments>
<add segment="node_modules" />
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
</configuration>
start.js文件的摘录:
var app = require('./app');
var debug = require('debug')('node-rest:server');
var http = require('http');
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
var server = http.createServer(app);
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
和视图(HBS):
<!DOCTYPE html>
<html>
<head>
<base href="/tep">
<title>Tennis Events Pro</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<tep-app>Loading...</tep-app>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="/tep/bundle.js"></script>
</body>
</html>
我围绕调整配置和路径,没有结果......
感谢
最大
我建议使用nginx的作为转发代理。更多的相关信息在这里: - https://ef.gy/using-nginx-as-a-proxy-server,-https://gist.github.com/soheilhy/8b94347ff8336d971ad0 –
看看这个约iisnode:HTTPS ://www.hanselman.com/blog/InstallingAndRunningNodejsApplicationsWithinIISOnWindowsAreYouMad.aspx – wannadream