Firebase asp.net push notifications works locally but not deployed - asp.net

I have a 2019 ASP.NET basic project for push notifications using Firebase and swagger and it works locally (i receive the message to my device). When I publish the project to the local file system and put that on the windows server (iis 10) it does not send the push notification, just reports:
{
"isSuccess": false,
"message": "Something went wrong"
}
What could the problem be? Is there a way to get a more detailed error?
I uploaded the launchSettings.json with my domain name set in the same folder which is not created when published but that made no difference.

Figured it out, the error was being handled in the code in a try catch so I just had to show the non-sanitized version of the error.

Related

Use fs.unlinkSync with full path to remove file in project, it works on local server, but it gives error(5xx) after deployed to azure web app

I have an app that builds with Vuejs and Nodejs server.
I created a folder called 'uploads' in the project to temporary store all of the files that was uploaded to the server.
When the uploaded action is ready, I have a restAPI to clean the file in folder 'uploads' with the given absolute path. I use fs.unlinkSync to remove the temp file in the rest api.
Everything works perfectly on local, but after I deploy to azure web app, whenever the restapi for removing a file is triggered, it gives me 502 bad gateway error.
I have checked a lot of information, still can not solve this problem. Wonder if anyone have experience with it?
Log from Azure Web App
Failed to forward request to application. Encountered a System.Threading.Tasks.TaskCanceledException exception after 300196.724ms with message: The operation was canceled.. Check application logs to verify the application is properly handling HTTP traffic.
Try to use fs.unlink(path, callback), then you can log more error details in callback function.
Suggestion
You also can use try..catch... to get more exception message. Get error details should be useful to you to solve the problem.
About Log from Azure Web App, I'm not sure how you use it, or use the default. The exception caught by the code may be more helpful to you.
If you use linux platform, you can use remote debugging.
Azure Remote Debugging for Node.js

Where can I see logs or details for error Azure "An error has occurred." for an API call on Azure?

I have an ASP.NET API and works great as local and using Postman.
Then I decided to publish to Azure since I tried on other free host SOMEE and never worked.
Principal API page on Azure works fine but when I tried to call a controller shows the error
{"Message":"An error has occurred."}
and I don't even know where to check more details about this error.
I tried the same on a Somee.com host and same thing happens
Azure portal offer to you some resources to investigate your issue
Log stream (in your App Service page, under Monitoring section), can give you some info of you api call.
Advanced Tools (in your App Service page, under Development Tools), can give you more information of your app settings, deployment info, wwwroot folder, etc...
It can be a deployment issue(related to the app service configuration, maybe you are using a docker container?) or a simple error in your connection string, so review your app service settings:
it's usually one of these(some) problems.
all the best

How ti fix the "You do not have permission to view this directory or page." issue in Azure web app services?

I have a simple web app which if I deploy to Azure through Intelij (Using Azure App plugin ) the app works perfectly. But when I tried deploying using Jenkins the log says deployment successful , but when I try to navigate to the site it says "You do not have permission to view this directory or page." Am I missing anything ?
As per my understanding as My project is working fine when deployed using Intelij, but not working through Jenkins, so the problem will be in my Jenkins Job. Here is the configuration I am using :
Publish Files
Files :target\spring-mvc-example.war
Source Directory(optional):target
Target Directory(optional): webapps
Could you please restart the website and check once.
For testing/debugging purposes you can turn on the Azure detailed messaging, and turn back off when its ready for production. To do so, you have to follow these two steps,
Login to Azure > App Services (left side menu) > Your Web App > Diagnostics logs (search box is at the top if you can't find it), then turn on Detailed Error Messages or turn on all of the logging options, up to you. Now add the following in your Web Config file, In your Web Config file add BEFORE system.web closing tag, . Similarly, add BEFORE . Finally, upload the Web Config to Azure and cross your fingers. If you follow the steps correctly, that will show the error messages in detail and hopefully from there

Deploying asp.net web api to azure app service

Problem: after deploying my asp.net core web api to azure app service I can't get a response from the expected endpoint
Steps followed:
I have an api that works fine when serving from my local machine, developed using Visual Studio Code. (The code for that is here https://github.com/samrae7/blog-api FYI)
I followed the instructions in this video: https://www.youtube.com/watch?v=C8J_CRy2_XA to push the files up to Azure App services. Basically I used the VS Code azure app service extension to create a webapp on azure and push my files.
I can see my files have been pushed to Azure ( by logging in to the portal and looking) but when I navigate to the expected URL of my api, http://sams-blog-api.azurewebsites.net, I get 'site not found'. If I try to send a request to the expected endpoint (I append /api/resource as this is the path of the endpoints on my local machine) I get '404 not found'
So my question is what do I have to do to actually get my api up and running online after pushing the files to azure app service
Thanks
Your website is not accessible due to missing DNS entry. I check it using the mxtool
https://mxtoolbox.com/SuperTool.aspx?action=a%3asams-blog-api.azurewebsites.net&run=toolpage#
Please ensure that your url is correct.
The basic answer to this question was that I had not understood that you have to create a Database in azure for your deployed app to connect to, and you need to set the connection string as an env variable in azure so that it knows where to look, and you should also add code that automatically updates the database on launch.
This tutorial was what helped with that: https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-dotnetcore-sqldb
I then hit another issue where the deployed app was still returning a generic 500 server error. By enabling 'Diagnostic logs' via the azure portal, and downloading the logs, I saw this detailed error: The configuration section 'httpProtocol' cannot be read because it is missing a section declaration referring to a piece of config in my Web.config. I deleted it (I don't need it for now) and that fixed the issue

azure deploy issue:do not have permission to view this directory or page

I tried to deploy my asp.net mvc web application to azure. But somehow, I could not using web deploy in vs2015 community, I always receive an error:
Web Deploy experienced a connection problem with the server and had to terminate the connection. Contact your server administrator if the problem persists. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CONNECTION_TERMINATED. WebApplication6 0.
So I changed to deploy using local git to deploy to azure. I was able to deploy, but when I typed in the url of the web app, I got:You do not have permission to view this directory or page. And I can't access any of the controller I defined in the code. Could any one help me out?
there are a few thing you can do to trouble shoot
first find out if your site is deployed.
go to https://{site name}.scm.azurewebsites.net/DebugConsole, navigate to "D:\home\site\wwwroot", make sure you see the right content is there.
check if your app deployed properly. If your site is asp.net site, when you do local git push (push your source code), you should see Azure will try to build your code. Check if deployment success. From debug console, go to https://{your site name}.scm.azurewebsites.net/api/deployments or from portal you should be able to see your deployment log
if none of the above help you to find out what is wrong, please report your site name here with this instruction https://github.com/projectkudu/kudu/wiki/Reporting-your-site-name-without-posting-it-publicly
I can help and look into your site.
Get the answer from git hub issues' reply, azure web app doesn't support asp.net 5 anymore.
I was facing same issue.
Verify following thing-
Go to deployed web app on azure portal and then go to App service editor and check required folder structure is available under WWWROOT folder and not WWWROOT->Webapp->bin etc.

Resources