I have a react app running fine on localhost:3000. When I deploy on Azure app service build and start up succeed but the error is that the app is not responding on 8080. Being able to view the output of console.log would really be a help to seeing whether the app is starting on the right port or not! I've configured app service logging but no log messages. I think both std.err and std.out should end up in the docker logs that I can view from VS Code. Is there something I could have missed?
In azure webapp, the port only supports 80 and 443, usually we define process.env.PORT || '3000' in the code like this.
It is recommended to use continuous deployment to make the deployment process more convenient.
Test Sample code. (offical sample code)
I modify it for test.
Deploy by git.
After deployed.
Setting App Service logs.
Check Log stream, you will find the content of console.log.
Related
I have web app and web api hosted on Azure App Service. It is a big application that works fine on IIS when hosted locally. When we hosted it on app service it works fine but only few things stopped working. I can't debug a code in App service because whole team is working on it, but when I host Web api in my personal azure account and used postman to debug it then also it works fine. When I check Application insight logging to figure out the issue, I can only see a log made by Web Api, this is the log:
How should I debug the issue in such a case?
When we hosted it on app service it works fine but only few things stopped working.
Make sure you are logging properly all your services in your Web App and Web API. You can check the details information of error in Application insights or in a KUDU console from there you can see the log files from where it has problem.
Using kudu:
https://<YourWebApp Service>.scm.azurewebsites.net/DebugConsole -> Log Files (Check the application logs)
How should I debug the issue in such a case?
The only solution is you can remote debug your application deployed in your App Service. For that you need to enable the remote debugging in your app service.
I can't debug a code in App service because whole team is working on it
If it is in a production environment, you can create a separate slot by MS-DOC and add your Web app and try to debug.
I need to log everything: application running on app service and app service itself. I see two options App Service Logging and Diagnostic Settings. What should I prefer? And Do I need to make any code change in order to log the app service? And what should I do in order to log the application running on it?
I just need an overview to make sure I don't mess up.
I created a simple web app (serverless) and deployed the web app using Azure App Service VS Code extension. I chose Linus + Node LTS environment. I configured deployment source to a local Git repo (also tried remote GitHub repo) and deployed. The deployment shows successful message. But when I browse the site, it throws a message (after 3-4 mins) that there was an ":( Application error". The admin diagnostics link doesn't show any error. Any reason why this could be happening?
Where can I find error details?
The web app compiles/runs fine on the local host.
Enable Log Streamming, then you'll be able to figure out what the problem is:
https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs
As another option, you can also instrument your application with Application Insights:
https://learn.microsoft.com/en-us/azure/azure-monitor/app/nodejs
On Azure WebApps, the container/application must respond to HTTP pings on the required port (check docker run command in the Log Stream) within 230 seconds, by default.
For a NodeJS app, you'd need to start the server in the following way:
const port = process.env.PORT || 1337;
server.listen(port);
Try deploying the sample available here:
https://github.com/Azure-Samples/nodejs-docs-hello-world
If that does not help, enable App Service Logs and check for any errors in the Log Stream.
I had created a NodeJS app which integrates with Application Insights some days back:
https://github.com/gkgaurav31/nodejs-application-insights-test-app
change your listen port either 8080 or 1337
By default, NodeJS webapp runs on port 8080. You are either running your port on some other port (Ex: 3000 or so) and then deploying it to webapp. Try changing your port in NodeJS app to 8080 and it should work.
I'm trying to deploy a Loopback project to live server, all works well on local. On server, after running node ., I get the console log of:
Web server listening at: http://domainname:3000
Browse your REST API at http://domainname:3000/explorer
So it looks like the server is running.
Problem is that I get no response from the server. Neither from domain:3000 or /explorer or any endpoint I created.
Does anyone know what might be the issue?
Thank you very much
I had a similar problem when I was trying to deploy my code. Some of the possible solutions to the problem depending on where and how you are deploying it-
Check if your security group allows connections on port 3000. AWS EC2 by default closes all ports except port 80. You might have to add an exception to your security group and allow port 3000 to be accessed from everywhere.
If you are using a container, check if your container has the ports open and if the container port is accessible by the hardware hosting the container. On Azure, I faced this problem as Azure Web App Container Service by default only listens to port 80 and 8080. So I had to modify my code such that it can use the default NODE_ENV.PORT or 8080.
App 1: I have a React app (based on create-react-app) which I've added as a Web App in Azure - that was pretty straight-forward to setup. This is using the JS SignalR client to communicate with the server, mentioned next.
App 2: This app is the ASP.NET Core SignalR Server application created with dotnet new console. This app exposes a SignalR endpoint and is "self hosted".
App 3: A 2nd ASP.NET Core console app is setup as a SignalR client. This is responsible to fetching some data, and sends those data to the SignalR server. This takes the SignalR endpoint (url) as a commandline argument.
Running all this locally is pretty straightforward:
App 1: npm start / serve -s build
App 2: dotnet run -commandline args (runs on localhost taking a hubpath and port from the args supplied. The port is so that multiple instances SignalR servers can run on localhost - not sure if this is the way to do it in Azure or if they're differentiated with separate urls and hosted seperately there)
App 3: dotnet run "http://localhost:5000/somenotificationhubname"
I've added a bat file in each of the console apps, so I can open multiple instances of those, with different args.
So locally it runs as easily as clicking 3 bat files.
But I'm kinda lost on how to host all this in Azure. The web app seemed pretty straightforward. I just created a web app in Azure, connected to it through an FTP client and copied over the contents of the build folder from the React app.
But what to do with the ASP.NET Core console applications so that the SignalR console app will be hosted in Azure and has its endpoint exposed for the other 2 apps to consume?
I tried adding both both App 2 and 3 as webjobs under App 1, but that didn't seem to work.
I've also heard that SignalR should not be running on IIS, so would it make sense to make it self-contained (exe) and run it inside a docker container? Any help is much appreciated.
I will suggest to change your app to use AppSettings file for configuration values instead of the commandline args.
You can easily change the value of appsettings without redeploying or changing anything.
You can have multiple appsettings file based on environments.
Allows you to easily duplicate the app with same code but different appsettings for your multiple signalr server.
This will make it easier to deploy using the standard publishing wizard in Visual Studio or via command line.
You could try the publish Profile in Azure App Service with the help of Visual Studio,
Reference 1
Reference 2
Once you successfully publish your webApp. You can double check the deployment using kudu service (or) App service editor
Advanced Tool-KUDU
AppService editor