问题#1
当我使用http://127.0.0.1/mysite/node/server.js
网址时,它会向我显示我的测试页面,这是正常的。但是,当我使用http://127.0.0.1/mysite/node/server.js/debug/
URL时,我希望它向我展示基于节点检查器的调试页面。但是,这不起作用,而是继续向我显示相同的示例页面内容。
我应该怎么做才能使调试器工作?
问题#2
此外,我注意到当我转到此网址时,它会自动重定向到
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 --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>
答案 0 :(得分:0)
问题#1
根据您的描述,您似乎在本地主机或Azure VM上调试和测试项目。在这种情况下,我们应该确保IIS首先安装了IISNode模块。因此,我建议您参考此document以确保已成功安装IISNode 其次,我们应该检查项目是否包含您的node-inspector配置。您还可以使用Node.js Sample检查节点检查器是否已成功安装。 第三,如果您不能使用此调试器,可以按“F12”来跟踪启用Webkit的Web浏览器中的调试器错误。如果您遇到错误,请在论坛上分享错误并获得进一步支持。
问题#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&amp; subtabid = 3。
您可以获得“http://127.0.0.1/public/content/default.aspx?tabid=2&subtabid=3”作为结果。 我建议你可以参考这个URL rewrite module了解更多细节。