Javascript 如何调试iisnode应用程序?

Javascript 如何调试iisnode应用程序?,javascript,node.js,express,iisnode,Javascript,Node.js,Express,Iisnode,我有几个iisnode应用程序在服务器上运行。它们都有应用程序池、web.config和server.js。他们都工作,除了一个 我们的内部DNS已设置为识别此URL 我查看了web.config和server.js文件,找不到应用程序不加载的任何原因。如果我运行“ng serve--port 3500”,它将出现在localhost:3500上,因此应用程序正常。 如果我运行'node server.js',应用程序将在端口8090上加载(根据server.js文件) 如果我运行'node s

我有几个iisnode应用程序在服务器上运行。它们都有应用程序池、web.config和server.js。他们都工作,除了一个

我们的内部DNS已设置为识别此URL

我查看了web.config和server.js文件,找不到应用程序不加载的任何原因。如果我运行“ng serve--port 3500”,它将出现在localhost:3500上,因此应用程序正常。 如果我运行'node server.js',应用程序将在端口8090上加载(根据server.js文件)

如果我运行'node server.js',应用程序将不会通过URL加载,而是通过servername:8090运行

server.js

var serverType = 'AM-LMS EDITOR';
var express = require('express');
var http = require('http');
var path = require('path');
var bodyParser = require('body-parser');
var app = express();
var port = process.env.PORT || 8090;

app.use(function(req,res,next){
    res.header("Access-Control-Allow-Origin","*");
    res.header("Access-Control-Allow-Methods", "GET,HEAD,OPTIONS,POST,PUT");
    res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, x-client-key, x-client-token, x-client-secret, Authorization");
    next();
    });


app.use(express.static(__dirname + '/dist/am-lms-admin'));

//body parse
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ limit: '50mb',extended: true }))


// parse application/json
app.use(bodyParser.json({limit: '50mb', extended: true}))
app.get('/*', (req,res) => res.sendFile(path.join(__dirname)));


app.all('/*', function(req, res, next) {
    // Just send the index.html for other files to support HTML5Mode
    res.sendFile('/dist/am-lms-admin/index.html', { root: __dirname });
});

// Handle 404
app.use(function(req, res) {
    //res.send(‘404: Page not Found’, 404);
    res.status(404).send({status:404, message: '404 Not Found', type:'client'}); 
   });

/// Handle 500
app.use(function(error, req, res, next) {
    res.status(500).send({status:500, message: 'internal error', type:'internal'}); 
   });

//listen
var httpServer = http.createServer(app);
httpServer.listen(port,() => console.log(serverType +' server running on port: '+ port));

web.config

<?xml version="1.0" encoding="utf-8"?>
<!--
     This configuration file is required if iisnode is used to run node processes behind
     IIS or IIS Express.  For more information, visit below link

     https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
-->

<configuration>
    <system.webServer>

        <!-- indicates that the server.js file is a node.js application
        to be handled by the iisnode module -->
        <webSocket enabled="false" />
        <handlers>
            <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
        </handlers>

        <rewrite>
            <rules>
        <!-- Do not interfere with requests for node-inspector debugging -->
                <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
                    <match url="^server.js\/debug[\/]?" />
                </rule>

        <!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
                <rule name="StaticContent">
                    <action type="Rewrite" url="public{REQUEST_URI}" />
                </rule>

        <!-- All other URLs are mapped to the node.js site entry point -->
                <rule name="DynamicContent">
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" />
                    </conditions>
                    <action type="Rewrite" url="server.js" />
                </rule>
            </rules>
        </rewrite>
        
    <security>
      <requestFiltering>
        <hiddenSegments>
          <remove segment="bin" />
        </hiddenSegments>
      </requestFiltering>
       <authorization>
                <remove users="*" roles="" verbs="" />
                <add accessType="Allow" users="amlgm\cclark, amlgm\tknoob, amlgm\tnakagawa, amlgm\csnyder, amlgm\rcarter" />

                
                
                

            </authorization>
    </security>
    
    <!-- Make sure error responses are left untouched -->
    <httpErrors existingResponse="PassThrough" />
     <!-- <httpErrors errorMode="DetailedLocalOnly">
      <remove statusCode="401" />
      <error statusCode="401" errorMode="Detailed"/>
    </httpErrors> -->

    </system.webServer>
</configuration>


您可以ping URL并获得响应吗?如果没有,则ping端口被阻止,或者DNS没有正确配置URL。如果ping有效,则尝试在URL处托管静态网页。静态网页是否加载?如果没有,这就提示Apache/Nginx config.Yes中存在问题-带有32字节数据的url pingsPinging servername.local[10.20.1.97]:Reply from 10.20.1.97:bytes=32 time=72ms TTL=127iisnode在每次访问应用程序时创建文件的所有应用程序的根目录下都有一个目录。此应用程序具有目录,但不生成任何文件。