Created express-gateway application and now I am trying to deploy on azure and for that created Azure App Service, once app service created than use of Github deployment process, deployed code on app service and now when I trying to access app service on browser than I am getting 500.1001 error and on log message is like that iisnode was unable to establish named pipe connection to the node.exe process
Web.config
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your Node.js application, please visit
http://go.microsoft.com/fwlink/?LinkId=290972
-->
<configuration>
<appSettings>
<!--
<add key="StorageAccountName" value="" />
<add key="StorageAccountKey" value="" />
<add key="ServiceBusNamespace" value="" />
<add key="ServiceBusIssuerName" value="" />
<add key="ServiceBusIssuerSecretKey" value="" />
-->
</appSettings>
<system.webServer>
<!-- mimeMap enables IIS to serve particular file types as specified by fileExtension. -->
<staticContent>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
<modules runAllManagedModulesForAllRequests="false" />
<!-- Web.Debug.config adds attributes to this to enable remote debugging when publishing in Debug configuration. -->
<iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.pug"/>
<!-- Remote debugging (Azure Website with git deploy): Comment out iisnode above, and uncomment iisnode below. -->
<!--<iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.pug"
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>
<add name="iisnode" path="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/f45f6d32-816b-47f0-8bfa-47f7930108a4" verb="*" resourceType="Unspecified"
type="Microsoft.NodejsTools.Debugger.WebSocketProxy, Microsoft.NodejsTools.WebRole"/>-->
</handlers>
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin" />
</hiddenSegments>
</requestFiltering>
</security>
<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>-->
<!-- Don't interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^server.js\/debug[\/]?" />
</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>
<!-- Remote debugging (Azure Website with git deploy): uncomment system.web below -->
<!--<system.web>
<httpRuntime targetFramework="4.5"/>
<customErrors mode="Off"/>
</system.web>-->
</configuration>
Server.js
require('dotenv').config();
var request = require('request');
const path = require('path');
const gateway = require('express-gateway');
gateway()
.load(path.join(__dirname, 'config'))
.run();
gateway.config.yml
http:
port: 8080
admin:
port: 9876
host: localhost
apiEndpoints:
api:
host: localhost
paths: '/ip'
serviceEndpoints:
httpbin:
url: 'https://httpbin.org'
policies:
- basic-auth
- cors
- expression
- key-auth
- log
- oauth2
- proxy
- rate-limit
pipelines:
default:
apiEndpoints:
- api
policies:
# Uncomment `key-auth:` when instructed to in the Getting Started guide.
# - key-auth:
- proxy:
- action:
serviceEndpoint: httpbin
changeOrigin: true
Related
I'm trying to run two node applications, one inside another in IIS to have the proper rote:
http://server/node1
http://server/node1/node2
I have this scenario in my IIS:
Default Web Site
- node1
- node2
The struggle is that the first application node (node1) works fine, but the second keep giving me Status Code 500, however when I deploy it outsite the virtual directory (node1) works, like this:
Default Web Site
- node1
- node2
This is the web.config that I'm using:
<configuration>
<appSettings>
<!-- for node1 -->
<add key="DEPLOY_PATH" value="/node1" />
<!-- for node2 -->
<add key="DEPLOY_PATH" value="/node1/node2" />
</appSettings>
<system.web>
<customErrors mode="Off" />
</system.web>
<system.webServer>
<httpErrors existingResponse="PassThrough" />
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="rewrite">
<match url="/*" />
<action type="Rewrite" url="app.js" />
</rule>
</rules>
</rewrite>
<iisnode maxNamedPipeConnectionRetry="1000" namedPipeConnectionRetryDelay="25000" />
<security>
<requestFiltering>
<hiddenSegments>
<add segment="node_modules" />
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
</configuration>
I couldn't find anything on the web about it, or similar work. I want to know why the node2 application doesn't work when deployed inside node1.
I have created a sample bot,which is working in bot emulator and azure bot service with localhost url,but when i deployed to azure and hit its live url it is giving internal error
The page cannot be displayed because an internal server error has occurred.
and web config file is
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode"/>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
<add name="Access-Control-Allow-Methods" value="GET,POST,PUT,DELETE,OPTIONS" />
<add name="Access-Control-Allow-Credentials" value="true" />
</handlers>
<rewrite>
<rules>
<rule name="DynamicContent">
<match url="/*" />
<action type="Rewrite" url="app.js"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
live url of site
https://hotel-reserve.azurewebsites.net/api/messages
I have upgraded the Node.js version to 8.8.1, and updated this in the process environmental variables, iisnode.yml, Web.config and package.json.
Nonetheless, requests going to the app now get rejected with the following error:
The iisnode module is unable to start the node.exe process. Make sure
the node.exe executable is available at the location specified in the
https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config>system.webServer/iisnode/#nodeProcessCommandLine
element of web.config. By default node.exe is expected in one of the
directories listed in the PATH environment variable.
I tried to update the file path in Kudu to reflect the path to the node.exe I'm interested in ("D:\Program Files (x86)\nodejs\8.1.1\node.exe"), but got an error saying I was not authorized to do this.
The relevant files:
iisnode.yml:
nodeProcessCommandLine: "D:\Program Files (x86)\nodejs\8.1.1\node.exe"
loggingEnabled: true
devErrorsEnabled: true
Web.config
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your Node.js application, please visit
-->
<configuration>
<appSettings>
<!--
<add key="StorageAccountName" value="" />
<add key="StorageAccountKey" value="" />
<add key="ServiceBusNamespace" value="" />
<add key="ServiceBusIssuerName" value="" />
<add key="ServiceBusIssuerSecretKey" value="" />
-->
</appSettings>
<system.webServer>
<!-- mimeMap enables IIS to serve particular file types as specified by fileExtension. -->
<staticContent>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
<modules runAllManagedModulesForAllRequests="false" />
<!-- Web.Debug.config adds attributes to this to enable remote debugging when publishing in Debug configuration. -->
<!--<iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.pug"/>-->
<!-- Remote debugging (Azure Website with git deploy): Comment out iisnode above, and uncomment iisnode below. -->
<iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.pug"
loggingEnabled="true"
devErrorsEnabled="true"
nodeProcessCommandLine="D:\Program Files (x86)\nodejs\8.8.1\node.exe --debug"/>
<!-- indicates that the server.js file is a Node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="index.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/blablabla" verb="*" resourceType="Unspecified"
type="Microsoft.NodejsTools.Debugger.WebSocketProxy, Microsoft.NodejsTools.WebRole"/>
</handlers>
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin" />
</hiddenSegments>
</requestFiltering>
</security>
<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>
<!-- Don't interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^server.js\/debug[\/]?" />
</rule>
<rule name="app" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
<match url="iisnode.+" negate="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="index.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
<!-- Remote debugging (Azure Website with git deploy): uncomment system.web below -->
<system.web>
<httpRuntime targetFramework="4.5"/>
<customErrors mode="Off"/>
</system.web>
</configuration>
In iisnode.yml, you have nodeProcessCommandLine pointing to 8.1.1 instead of 8.8.1. Maybe that's just it?
I'm trying get all http traffic to redirect to https using web.config on azure. I'm using node.js stack.
I want the url to remain the same for all requests. Currently, however, it's appending server.js to the end of the route.
The problem:
Go to http://www.example.com/
Redirect to https://www.example.com/server.js
Below is my web.config file I'm using.
<?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 server.js file is a node.js site to be handled by the iisnode module -->
<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>
<!-- Redirect all http traffic to https -->
<rule name="Redirect to https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</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
See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options
-->
<!--<iisnode watchedFiles="web.config;*.js"/>-->
</system.webServer>
</configuration>
Maybe you can try to install the extension named Redirect HTTP to HTTPS via the Azure portal, with this approach you have no need to add any rule for redirecting to HTTPS.
I have an app that works locally but when I deploy it to azure POST requests receive a 404 response. Various answers suggest that I need to edit my web.config but I don't see what needs to be changed.
If it's relevant: My POSTs are to a path called /receive on the server, which should be handled by server.js
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your Node.js application, please visit
http://go.microsoft.com/fwlink/?LinkId=290972
-->
<configuration>
<appSettings>
<!--
<add key="StorageAccountName" value="" />
<add key="StorageAccountKey" value="" />
<add key="ServiceBusNamespace" value="" />
<add key="ServiceBusIssuerName" value="" />
<add key="ServiceBusIssuerSecretKey" value="" />
-->
</appSettings>
<system.webServer>
<!-- mimeMap enables IIS to serve particular file types as specified by fileExtension. -->
<staticContent>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
<modules runAllManagedModulesForAllRequests="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>
<add name="iisnode" path="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/eee3ec35-9835-494f-a07c-dc2f85619df0" verb="*" resourceType="Unspecified"
type="Microsoft.NodejsTools.Debugger.WebSocketProxy, Microsoft.NodejsTools.WebRole"/>-->
</handlers>
<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>-->
<!-- Don't interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^server.js\/debug[\/]?" />
</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>
<!-- Remote debugging (Azure Website with git deploy): uncomment system.web below -->
<!--<system.web>
<httpRuntime targetFramework="4.5"/>
<customErrors mode="Off"/>
</system.web>-->
</configuration>
I tested your web.config file in my test node.js application, everything worked fine on my side. It should be any other reason which caused your issue. Could you kindly provide more info about your application, e.g. how you deploy to Azure Web Apps, what's your structure and any key code snippet related to the post functionality. These may help communities to detect the queston.
Meanwhile, you can try to leverage Log Stream tool to trace the all the info and stdout of your application while the Azure App is running.
You can login on your Azure Portal, navigate to Azure Apps blade, click Diagnostics Logs => Enable Application Logging (Filesystem), and then click Log stream to open the tool.