Issue : raiseUrlNotFoundError while trying to host loopback application on Windows machine IIS

222 views
Skip to first unread message

chirag khare

unread,
Jun 16, 2018, 3:41:26 AM6/16/18
to LoopbackJS
  1. Scaffold app using slc loopback, which works fine if i do node . from command prompt.

  2. after installing iisnode and rewrite module, went ahead and created an application on IIS and pointed it to the folder for app.

  3. created an index.js file outside server folder with below code:
    var app = require('./server/server.js');
    app.start();

  4. Created a web.config, which looks like below:

<?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:

-->

<configuration>
<system.webServer>
<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="index.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="^index.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="index.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

-->
<!--<iisnode watchedFiles="web.config;*.js"/>-->
</system.webServer>
</configuration>



Now when i am trying to access the url in browser http://localhost/smsapi/. This gives me error:

Error
404 Cannot GET /smsapi/
status: 404
Error: Cannot GET /smsapi/
at raiseUrlNotFoundError (C:\GitHub\smsapi\sms\node_modules\loopback\server\middleware\url-not-found.js:21:17)
at Layer.handle [as handle_request] (C:\GitHub\smsapi\sms\node_modules\express\lib\router\layer.js:95:5)
at trim_prefix (C:\GitHub\smsapi\sms\node_modules\express\lib\router\index.js:317:13)
at C:\GitHub\smsapi\sms\node_modules\express\lib\router\index.js:284:7
at Function.process_params (C:\GitHub\smsapi\sms\node_modules\express\lib\router\index.js:335:12)
at next (C:\GitHub\smsapi\sms\node_modules\express\lib\router\index.js:275:10)
at C:\GitHub\smsapi\sms\node_modules\express\lib\router\index.js:635:15
at next (C:\GitHub\smsapi\sms\node_modules\express\lib\router\index.js:260:14)
at Function.handle (C:\GitHub\smsapi\sms\node_modules\express\lib\router\index.js:174:3)
at router (C:\GitHub\smsapi\sms\node_modules\express\lib\router\index.js:47:12)
at Layer.handle [as handle_request] (C:\GitHub\smsapi\sms\node_modules\express\lib\router\layer.js:95:5)
at trim_prefix (C:\GitHub\smsapi\sms\node_modules\express\lib\router\index.js:317:13)
at C:\GitHub\smsapi\sms\node_modules\express\lib\router\index.js:284:7
at Function.process_params (C:\GitHub\smsapi\sms\node_modules\express\lib\router\index.js:335:12)
at next (C:\GitHub\smsapi\sms\node_modules\express\lib\router\index.js:275:10)
at nosniff (C:\GitHub\smsapi\sms\node_modules\dont-sniff-mimetype\index.js:4:5)

Pavan

unread,
Jun 16, 2018, 9:52:39 AM6/16/18
to loopb...@googlegroups.com
Hi,

Loopback by default starts the server at 3000.
I see that you have just used localhost. Did you try:

Regards
Pavan

--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/d91e5655-7353-4d48-b2de-9580ccc860a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

chirag khare

unread,
Jun 16, 2018, 10:58:55 AM6/16/18
to LoopbackJS
It Still responds 404.

1. This is a windows machine
2. i've pointed the virtual application to solution folder.
404.JPG
Reply all
Reply to author
Forward
0 new messages