Azure Web Apps의 node.js 응용 프로그램은 고전적인 숫자 포트를 수신하지 않으므로 iisnode가 수신하는 기본 포트에서 웹 요청에 응답합니다. 당신이 당신의 main.ts
스크립트를 수정하려고 할 수
:
let server: Server = new Server(process.env.PORT || 3000);
그리고 푸른 웹 앱에 Node.js를 응용 프로그램에 대한 요청이 iisnode를 통해 처리됩니다, 당신은 루트 디렉토리에 web.config
구성 파일을 작성해야 시나리오에서 입구 파일을 설정하려면 여기 bin\main.js
입니다.
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:
https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
-->
<configuration>
<system.webServer>
<!-- Visit http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx for more information on WebSocket support -->
<webSocket enabled="false" />
<handlers>
<!-- Indicates that the bin/main.js file is a node.js site to be handled by the iisnode module -->
<add name="iisnode" path="bin/main.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="^bin/main.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="bin/main.js"/>
</rule>
</rules>
</rewrite>
<!-- bin directory has no special meaning in node.js and apps can be placed in it -->
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin"/>
</hiddenSegments>
</requestFiltering>
</security>
<!-- Make sure error responses are left untouched -->
<httpErrors existingResponse="PassThrough" />
<!--
You can control how Node is hosted within IIS using the following options:
* watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server
* node_env: will be propagated to node as NODE_ENV environment variable
* debuggingEnabled - controls whether the built-in debugger is enabled
To debug your node.js application:
* set the debuggingEnabled option to "true"
* enable web sockets from the portal at https://manage.windowsazure.com/#Workspaces/WebsiteExtension/Website/garynodedeploy/configure
* browse to https://garynodedeploy.azurewebsites.net/bin/main.js/debug/
See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options
-->
<iisnode watchedFiles="web.config;*.js" debuggingEnabled="false" />
</system.webServer>
</configuration>
당신은 iisnode에 대한 자세한 정보를 원하시면 https://github.com/tjanczuk/iisnode를 참조 할 수 있습니다.
Repo에 대한 링크가 작동하지 않습니다. – DAXaholic
형식이 잘못되었습니다. – Somkun
@Somkun에서 해결되었으므로 문제가 해결 되었습니까? 그렇다면이 질문을 삭제해야합니다. –