Angular Universal Deployment to IIS server giving error - node.js

I have an angular universal project. After the production build dist folder was generated successfully. After putting the content in the server root folder it's displaying the following error -
iisnode encountered an error when processing the request.
HRESULT: 0x2
HTTP status: 500
HTTP subStatus: 1002
HTTP reason: Internal Server Error
You are receiving this HTTP 200 response because system.webServer/iisnode/#devErrorsEnabled configuration setting is 'true'.
In addition to the log of stdout and stderr of the node.exe process, consider using debugging and ETW traces to further diagnose the problem.
The node.exe process has not written any information to stderr or iisnode was unable to capture this information. Frequent reason is that the iisnode module is unable to create a log file to capture stdout and stderr output from node.exe. Please check that the identity of the IIS application pool running the node.js application has read and write access permissions to the directory on the server where the node.js application is located. Alternatively you can disable logging by setting system.webServer/iisnode/#loggingEnabled element of web.config to 'false'.
My main.js and web.config file are under the project directory with the dist folder and I gave all users full control permission in the root folder but still there is no luck.
Any help will be appreciated. Thanks in advance.

Please make sure the permissions to give the IIS_IUSRS group write permissions to that folder
Go into the advanced settings menu and under Process Model -> Identity change the user account to a user that already has write permissions.
And this link provide the steps to set node JS in IIS:
https://www.hanselman.com/blog/InstallingAndRunningNodejsApplicationsWithinIISOnWindowsAreYouMad.aspx
Maybe you need to check whether the static content feature in turn windows features on or off/IIS/world wide web service/http common feature/static content has been installed.

Related

How can I fix IISNode internal server error? listen EACCESS permission denied

I added a node application as a website on IIS with a web config file and whenever I try to browse the website it gives this error:
Error on web browser.
I have tried using the taskkill command to stop the process listening to this port and I also tried giving IIS_IUSRS user full permission on the root folder, but this issue persists
web.config file:
config file image
So I was able to find my way around this issue. I removed the application from IIS and I used pm2 to start the node application and I didn't encounter any error after using this approach.

wwwroot doesn't exist in inetpub

I installed IIS on my computer, but when I try to load localhost on google chrome it's says
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information:
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x80070003
Config Error Cannot read configuration file
Config File \?\C:\inetpub\wwwroot\web.config
Requested URL http://localhost:80/
Physical Path
Logon Method Not yet determined
Logon User Not yet determined
I also don't have wwwroot in my inetpub folder and I think that's why the error above appears. I created then my wwwroot folder in the ineptpub folder, but I have a new error: HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
What can I do in this situation?

iisnode not able to access file present in network file path

I am node app through iisnode. I can access file present in network path but when the application tries to access the file, it complains ' File doesn't exist'.
I tried adding IIS_IUSRS user group to have access to iisnode www directory in my local machine. I changed the username(from application pool) of the application to which I have permission(R/W) on the network path. Restarted my machine. But still problem persist.
Can someone help me if there is issue between iisnode and network file path.
const csv=require('csvtojson');
function fetchFile(){
sUsagefile ="\\\\abc\\xyz\\com.csv" .
csv().fromFile(sUsagefile));
console.log(sUsagefile);
}
Error: File does not exist. Check to make sure the file path to your csv is correct.
at C:\iisnode\www\node_modules\csvtojson\v2\Converter.js:81:37
at FSReqWrap.cb [as oncomplete] (fs.js:312:19)
I tried to access UNC path with iisnode and it was working perfectly.
Have you tried to grant IUSR and IIS Apppool\ read/writepermission for network path \abc\xyz\com.csv directly?
Besides, have you checked whether \abc\xyz\com.csv can be accessed from file explorer when IIS stop working.
It is suggested to use process monitor tool to monitor what path is read by node.exe. Please download process monitor from here:https://learn.microsoft.com/zh-cn/sysinternals/downloads/procmon then add a filter like “Path contains com.csv". Finally we would know what path the application is trying to read.

Azure Node hosting file/folder permissions

I have launched my sails.js app to Azure Node.js shared infrastructure.
App does not lift due to file permission. Seems like grunt tasks cannot create
concatenated files in .tmp directory in the root.
I tried to give write access via FileZilla but it did not worked. When ever I try to hit URL
I see file permissions are getting set into default values.
I also did not see any settings to give Folder permissions at Azure Dashboard.
Is there any workaround on this issue?
Error:
** Grunt :: An error occurred. **
------------------------------------------------------------------------ [31mAborted due to warnings.[39m Running "sails-linker:prodJs"
(sails-linker) task[24m Autoinsert script tags in an html file
[33mWarning: ENOTSUP: operation not supported on socket, scandir
'D:\home\site\wwwroot.tmp\public\concat\production.css' [39m
------------------------------------------------------------------------ Looks like a Grunt error occurred-- Please fix it, then restart
Sails to continue running tasks (e.g. watching for changes in
assets) Or if you're stuck, check out the troubleshooting tips below.
[4mTroubleshooting tips:[24m
*-> Are "grunt" and related grunt task modules installed locally?
Run npm install if you're not sure.
*-> You might have a malformed LESS, SASS, CoffeeScript file, etc.
*-> Or maybe you don't have permissions to access the .tmp
directory?
e.g., D:\home\site\wwwroot\.tmp ?
If you think this might be the case, try running:
sudo chown -R YOUR_COMPUTER_USER_NAME D:\home\site\wwwroot\.tmp
According to the error information below, it seems that the sails app default start up for websocket on the port 1337, but the Azure webapp only enable the ports 80 and 443.
Warning: ENOTSUP: operation not supported on socket
There was an SO thread Deploy sails.js to Windows Azure Website that discuss about deploying the sails app on Azure WebApp.
Hope it helps. Best Regards.

Debug Node.js - The iisnode module is unable to deploy supporting files necessary to initialize the debugger

I get the following error when I try to debug a node.js application using Azure SDK for Node.js:
The iisnode module is unable to deploy supporting files necessary to initialize the debugger. Please check that the identity of the IIS application pool running the node.js application has read and write access permissions to the directory on the server where the node.js application is located.
I have installed the full version of iisnode and added the config settings in web.config. Here is an example of what I type in the browser:
http://server:81/server.js/debug
. The application is using IIS Express to run that is provided in the latest Windows Azure SDK for Node.js - August 2012.
Any help will be appreciated!
There are two possible issues here, depending on which version of the Azure SDK for Node you are running:
(1) If you are running a version < 0.6, then this is almost certainly a permissions issue with your webrole directory. Note that, in IIS, it's the actual web role directory and not the directory in local_package.csx that is actually used in the web role. Make sure that iiS_IUSRS has write access to this directory and it should work.
(2) If you are running a version >= 0.6, then the problem is that you are using an iisnode version that isn't iis full inside iisexpress. You can get around this by editing setup_web.cmd to use the path to the iisnode dll in your iisnode directory (rather than the iisnode-dev directory or the SDK directory).

Resources