繁体   English   中英

使用IISNode的Windows Azure IIS上的Node.js:如何设置节点检查器调试器?

[英]Node.js on Windows Azure IIS using IISNode: How to setup node-inspector debugger?

问题1

当我使用http://127.0.0.1/mysite/node/server.js URL时,它显示了我的测试页,这很好。 但是我希望当我使用http://127.0.0.1/mysite/node/server.js/debug/ URL时,它能向我显示基于节点检查器的调试页面。 但是,这不起作用,而是继续向我显示相同的示例页面内容。

我应该做什么才能使调试器正常工作?

问题#2

另外,我注意到当我转到该URL时,它会自动重定向到

http://127.0.0.1/mysite/ public / mysite / node / server.js / debug /

为什么会这样呢? 我可以避免这种重定向吗? 如果是,怎么办?

Web.config内容

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />


<!-- Web.Debug.config adds attributes to this to enable remote debugging when publishing in Debug configuration. -->
<!--<iisnode watchedFiles="web.config;*.js"/>--> 

<!-- Remote debugging (Azure Website with git deploy): Comment out iisnode above, and uncomment iisnode below. -->
<iisnode watchedFiles="web.config;*.js"
  loggingEnabled="true"
  devErrorsEnabled="true"
  nodeProcessCommandLine="node.exe &#45;&#45;debug"/>

<!-- indicates that the server.js file is a Node.js application 
to be handled by the iisnode module -->
<handlers>
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
    <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
    <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />

    <add name="iisnode" path="node/server.js" verb="*" modules="iisnode" />

    <!-- Remote debugging (Azure Website with git deploy): Uncomment NtvsDebugProxy handler below.
    Additionally copy Microsoft.NodejsTools.WebRole to 'bin' from the Remote Debug Proxy folder.-->
    <add name="NtvsDebugProxy" path="ntvs-debug-proxy/95a6beca-6da8-493c-b380-2822603aa5dc" verb="*" resourceType="Unspecified"
    type="Microsoft.NodejsTools.Debugger.WebSocketProxy, Microsoft.NodejsTools.WebRole"/>
</handlers>

<rewrite>
  <rules>
    <clear />

    <rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
      <match url="^[a-zA-Z0-9_\-]+\.js\.logs\/\d+\.txt$"/>
    </rule>

    <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
      <match url="^server.js\/debug[\/]?" />
    </rule>

    <rule name="StaticContent">
      <action type="Rewrite" url="public{REQUEST_URI}"/>
    </rule>

    <rule name="DynamicContent">
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
      </conditions>
      <action type="Rewrite" url="node/server.js"/>
    </rule>

  </rules>
</rewrite>
<!-- <rewrite>
  <rules>
    <clear />
    <!- Remote debugging (Azure Website with git deploy): Uncomment the NtvsDebugProxy rule below. ->
    <!-<rule name="NtvsDebugProxy" enabled="true" stopProcessing="true">
      <match url="^ntvs-debug-proxy/.*"/>
    </rule>->
    <rule name="app" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
      <match url="iisnode.+" negate="true" />
      <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
      <action type="Rewrite" url="server.js" />
    </rule>
  </rules>
</rewrite> -->
  </system.webServer>

问题#1

根据您的描述,您似乎在本地主机或Azure VM上调试和测试了项目。 在这种情况下,我们应确保IIS首先安装了IISNode模块 因此,我建议您可以参考本文档以确保已成功安装IISNode。
其次, 我们应该检查项目是否包括您的node-inspector配置 您还可以使用Node.js Sample来检查是否已成功安装Node-inspector。 第三,如果无法使用此调试器,则可以在支持Webkit的Web浏览器中按“ F12”以跟踪调试器错误 如果遇到错误,请在论坛上分享该错误,并寻求进一步的支持。

问题#2

对于第二个问题,似乎URL重写规则导致了该错误的URL。

<rule name="StaticContent">
      <action type="Rewrite" url="public{REQUEST_URI}"/>
</rule>

例如,如果对此URL进行了请求:“ http://127.0.0.1/content/default.aspx?tabid=2&subtabid=3 ”,那么REQUEST_URI服务器变量将包含content / default.aspx?tabid = 2&subtabid = 3。

结果为“ http://127.0.0.1/public/content/default.aspx?tabid=2&subtabid=3 ”。 我建议您可以参考此URL重写模块以获取更多详细信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM