Node.js IIS节点应用程序赢得';是否无法使用Web.Config正确运行?

Node.js IIS节点应用程序赢得';是否无法使用Web.Config正确运行?,node.js,iis,web-applications,web-config,iisnode,Node.js,Iis,Web Applications,Web Config,Iisnode,我有一个要使用IIS运行的节点应用程序。问题是我的配置文件。我正在使用IIS 10.0,不知道如何正确配置所有内容?每当我在Web.Config文件中包含这两个规则时 <!-- First we consider whether the incoming URL matches a physical file in the /public folder --> <rule name="StaticContent" patternSyntax="Wildcard">

我有一个要使用IIS运行的节点应用程序。问题是我的配置文件。我正在使用IIS 10.0,不知道如何正确配置所有内容?每当我在Web.Config文件中包含这两个规则时

<!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
<rule name="StaticContent" patternSyntax="Wildcard">
    <action type="Rewrite" url="public/{R:0}" logRewrittenUrl="true"/>
        <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
        </conditions>
        <match url="*.*"/>
</rule>

<!-- All other URLs are mapped to the Node.js application entry point -->
<rule name="DynamicContent">
     <conditions>
         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
     </conditions>
     <action type="Rewrite" url="server.js"/>
 </rule>
谢谢你的帮助。我似乎不明白这个问题

我在一个单独的脚本中发出post请求,该脚本位于该目录中的一个单独文件夹中,名为脚本:

xhttp.open("POST", "http://localhost:80/My Application/postrequest", false);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("date=" + date + "&name=" + name + "&type=" + type);

通过在my Web.Config中使用以下配置,我能够成功地将我的节点Web应用程序发布到IIS:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
    </handlers>

    <rewrite>
      <rules>
         <!-- Don't 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" patternSyntax="Wildcard">
               <action type="Rewrite" url="public/{R:0}" logRewrittenUrl="true"/>
               <conditions>
                  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
               </conditions>
            <match url="*.*"/>
         </rule>

         <!-- All other URLs are mapped to the Node.js application entry point -->
         <rule name="DynamicContent">
               <conditions>
                  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
               </conditions>
            <action type="Rewrite" url="server.js"/>
         </rule>

         <rule name="SocketIO" patternSyntax="ECMAScript">
               <match url="socket.io.+"/>
            <action type="Rewrite" url="server.js"/>
         </rule>
      </rules>
    </rewrite>

    <iisnode promoteServerVars="LOGON_USER" />

  </system.webServer>
</configuration>
xhttp.open("POST", "http://localhost:80/My Application/postrequest", false);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("date=" + date + "&name=" + name + "&type=" + type);
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
    </handlers>

    <rewrite>
      <rules>
         <!-- Don't 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" patternSyntax="Wildcard">
               <action type="Rewrite" url="public/{R:0}" logRewrittenUrl="true"/>
               <conditions>
                  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
               </conditions>
            <match url="*.*"/>
         </rule>

         <!-- All other URLs are mapped to the Node.js application entry point -->
         <rule name="DynamicContent">
               <conditions>
                  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
               </conditions>
            <action type="Rewrite" url="server.js"/>
         </rule>

         <rule name="SocketIO" patternSyntax="ECMAScript">
               <match url="socket.io.+"/>
            <action type="Rewrite" url="server.js"/>
         </rule>
      </rules>
    </rewrite>

    <iisnode promoteServerVars="LOGON_USER" />

  </system.webServer>
</configuration>
var http = require('http');
var express = require('express');
var bodyParser = require('body-parser');         // Used to parse incoming messages
var port = process.env.port;

var app = express(function(req, res){
    username = req.headers['x-iisnode-auth_user'];
});

app.use(express.static(__dirname + "/ApplicationNameOnIIS/"));

app.use(bodyParser.urlencoded({ extended: false }))

app.use(bodyParser.json())

// Start listening on server port
app.listen(process.env.PORT);

app.get('/ApplicationNameOnIIS/', function(req, res) {
    res.sendfile(__dirname + '/index.html');    
});

// ...The Rest Of My Code...