I am new to Node.js and I have created a basic application in node.js and trying to deploy on Azure web App service.
After successful deployment, when I am trying to hit a website it showing me two types of error like You do not have permission to view this directory or page.
or website not responding.
In both cases, when I tried to trace the logs, it shows me following logs in the things you can try
If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.
Enable directory browsing using IIS Manager.
Open IIS Manager.
In the Features view, double-click Directory Browsing.
On the Directory Browsing page, in the Actions pane, click Enable.
Verify that the configuration/system.webServer/directoryBrowse#enabled attribute is set to true in the site or application configuration file.
How can I resolve the error?
You can try this approach:-
Create a web.config file at the root of the app directory.
Add the following code to web.config:
<configuration>
<system.webServer>
<!-- indicates that the index.js file is a node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="index.js" verb="*" modules="iisnode" />
</handlers>
<!-- adds index.js to the default document list to allow
URLs that only specify the application root location,
e.g. http://mysite.antarescloud.com/ -->
<defaultDocument enabled="true">
<files>
<add value="index.js" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
Hope it helps. You can try enabling customerror=off to for troubleshooting exact error.For reference please follow:
Azure website message "You do not have permission to view this directory or page.". What to do?
MV
Related
I have been given access to an IIS server
Windows 2012 R2
IIS version 8.5.9600
I successfully installed
python 3.8
wfastcgi
flask
i wrote a basic "hello world" python flask app which i tested and works on the localhost machine
I created my web.config file and has the following
<configuration>
<system.webServer>
<handlers>
<add name="Python FastCGI"
path="*"
verb="*"
modules="FastCgiModule"
scriptProcessor="C:\Python36\python.exe|C:\Python38\Lib\site-packages\wfastcgi.py"
resourceType="Unspecified"
requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<!-- Required settings -->
<add key="WSGI_HANDLER" value="hello.app" />
<add key="PYTHONPATH" value="C:\inetpub\wwwroot\test_site" />
</appSettings>
</configuration>
For this site i enabled IISUsers to have Modify and Write access
I am unable to load the site though. Am i missing anything in the configuration?
When i click on IIS, FasCTI Settings appears and properly points to the python.
I am getting a 500 error in the logs.
help is alwasy appreciated.
Best
DamnGroundHog
So it looks like i have everything correct but i decided to play around with some settings, specifically bindings.
when i changed the port from 80 to 8080 and took the host name away, it worked. Yay! Now i will look at bindings and see why my basic index.html worked but the hello.py didn't
Through my restoration of a project similar to your python project, it can be successfully run on the window server. I follow this tutorial, you can refer to it.
Detail steps
In the process of my application, it only works when the port is also 8080 because the application is deployed under the default website. At the same time index.html works because the default document is set, you can check your default document module.
Machine: Windows Server 2012 R2 with IIS 8.5 on a company network.
Following this tutorial
Success: In IIS, deployed a published folder of an ASP.NET MVC Core 1.1.1 app to an Application Folder under Default Website. From a desktop on the same network, browsed to the URL http://IP Address/MyPublishedFolder. The app successfully displayed its home page.
Failure: Created a custom website on the same IIS with one of the DNS Names at the company: Ourapps.ac.CompanyName.com with host folder named as Ourapps.ac.CompanyName.com. Copied the exact same published folder MyPublishedFolder to Ourapps.ac.CompanyName.com. From a desktop on the same network, browsed to the URL: http://Ourapps.ac.CompanyName.com/MyPublishedFolder. Got the browser error: HTTP Error 502.5 - Process Failure. In the Event Viewer, the Application Log shows the following error:
Application 'MACHINE/WEBROOT/APPHOST/Ourapps.ac.CompanyName.com' with physical root 'C:\Ourapps.ac.CompanyName.com\' failed to start process with commandline '"" ', ErrorCode = '0x80070057 : 0.
Question: Why the same app is working under Default Websitebut not under custom website - and how can we resolve the issue?
Note:
http://Ourapps.ac.CompanyName.com/MyPublishedFolder works fine if I replaced all content of MyPublishedFolder with a simple Index.html file created on a notepad. So the issue does seem to be related to ASP.NET Core's published folder deployed to a custom website
Both the apps on the above examples are running with a No Managed Code Application Pool.
UPDATE:
Please note the same ASP.NET Core website works fine under Default Website on the same server. That means the sever has all the necessary configurations (hosting bundle DotNetCore.1.0.5_1.1.2-WindowsHosting installed etc.) for an ASP.NET Core 1.1.1 to run on IIS.
Web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MyCoreWebApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
</system.webServer>
</configuration>
<!--ProjectGuid: 9e4933bc-a6d0-4aa8-b34c-c6db94ed0742-->
I have an ASP.NET Core 1.0 application which has been successfully deployed and running on our pre-prod server for months. Today I tried deploying the website to our production server using this article as a guideline:
https://docs.asp.net/en/latest/publishing/iis.html
Bottom line is we can't get past this error:
HTTP Error 502.5 - Process Failure
Common causes of this issue:
* The application process failed to start
* The application process started but then stopped
* The application process started but failed to listen on the configured port
We tried the ideas listed in this article, but still no luck:
ASP.NET Core 1.0 on IIS error 502.5
How do you go about debugging a 502.5 error, to get to the actual cause of the failure?
The app's log files are getting created, but unfortunately they are empty. The web server's Event Viewer contains this entry:
Process was created with commandline 'D:\Applications\PVP\UserInterface.exe' but failed to get the status, errorCode = 0x80070005
Any help would be very much appreciated! Tory.
Try to isolate whether the problem is the server (IIS) or the app. Do that by finding and running the app directly. Find your web.config and run the process.
For a DLL this is:
dotnet MyApp.dll
For an EXE this is:
MyApp.exe
For you this probably means running D:\Applications\PVP\UserInterface.exe directly.
I've been struggling with this with a .NET Core 2.0 site and once I realized that IIS needs a web.config on the server, I got past it.
Here is my file, the key elements for me were the processPath and arguments.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet"
arguments=".\My App.dll"
stdoutLogEnabled="true"
stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
I know this question has been asked and answered a few time but those questions are slightly different and the answers to those questions do not resolve my issue.
I have a asp.net 5 & MVC 6 application that works fine in IIS Express and self hosted in WEB. However when I publish to a folder and point IIS at the wwwroot folder I get the HTTP Error 403.14 - Forbidden error.
I have tried IISReset and I do have a default root.
Requirements
Windows 7 or better
Windows Server 2008 R2 or better
Have IIS installed
Procedure
First, make sure you have the HTTP Platform Handler installed in your IIS (x86 / x64).
Publish your application to the file system and take the content of the \artifacts\bin\MyWebApp\Release\Publish folder and copy it into your IIS Server.
When configuring your application, target the wwwroot folder that you copied over.
Now you'll need to unlock the system.webServer/handlers section which can be found in IIS Manager on the server node under Configuration Editor. Search for the right section and unlock it from the right action pane.
Make sure that the App Pool is set to No Managed Code. DNX is being run as an external process. IIS doesn't need to know about what it's currently running.
Finally, create a web.config with the following content:
<configuration>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="..\approot\web.cmd" arguments="" stdoutLogEnabled="false" stdoutLogFile="..\logs\stdout.log" startupTimeLimit="3600"></httpPlatform>
</system.webServer>
</configuration>
It should be running at that point.
Source
Info: I am very new to node.JS!
I have written a sample server that can listen to http requests on port XXXX. When I run this server from commandline (Windows) it seems to work well. It responds to the requests made to localhost:XXXX when opened in a browser.
Question: Is this how this is supposed to work? For the node server to run, should there always be a CMD prompt open for the server to listen to requests?
Can I not do "something" with IISNode?
I understand that if I make a request to a JS files, which is noted in IISNode as a Node.JS file and that NODE should be handling it; then I will have Node handling the request for me.
But then this assumes that IIS is the web server for me and that specific requests can be handled by Node.
I hope I am making sense here! :)
On Windows you have two options of hosting node.js applications:
Self-host the node.exe process just like you would on *nix. During development you will probably just start it from the command line. In production you want to come up with a mechanism that will provide process lifetime management around node.exe (e.g. start it when the OS starts). The most reasonable way of doing it on Windows is to use Windows Services (also known as NT Services). A component that can help you do this is http://nssm.cc/.
Host node.js with the IIS using iisnode (http://github.com/tjanczuk/iisnode). Compared to self-hosting this method has a number of benefits outlined in https://github.com/tjanczuk/iisnode/wiki. But you also want to explore the performance implications (not all of them bad actually): http://tomasz.janczuk.org/2012/06/performance-of-hosting-nodejs.html.
I solved it using a proper method. Yes, IISNode it is.. But none of comments seemed to answer how to "run" app.js for different applications hosted on same IIS (which is also serving PHP, ASPX, etc)
Step 1.
Edit your node application’s entry-point (typically) app.js for the new URL structure.
An express app assumes that it owns the entire URL space and starts the URLs from the root itself, as shown:
Edit you app.js to look like the following (but put YOUR app’s directory name instead of “aaspass”!!):
Now put a web.config file at the root of your app which looks like the following (You may use this template: webconfig).
Again edit the file and change the name “aaspass” to your app’s directory name.
Thats it! You may do this for as many apps as required and host them on SAME server.
What worked for me:
Install IISNode
Install URL Rewrite module of IIS
Add web.config file in your Node.js app/folder. Here are the content of web.config file:
In the handler, I just need to point to app.js (typical entry point of your application). I have not made changed to any of my routes (there is no need to append any text).
..
<configuration>
<appSettings>
<add key="NODE_ENV" value="production" />
</appSettings>
<system.webServer>
<handlers>
<add name="iisnode" path="server/app.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<clear />
<rule name="cdw">
<match url="/*" />
<action type="Rewrite" url="server/app.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
If you are on Windows you can (and probably should) run Node.js under IIS:
http://www.hanselman.com/blog/InstallingAndRunningNodejsApplicationsWithinIISOnWindowsAreYouMad.aspx