Azure app service startup command (required) - linux

I am deploying my ASP.NET Core 3.1 app to Azure App Service. While creating the new app service, I chose Linux as Operating System. In deployment center, when I deploy the app, it prompts me to enter a startup command. Everywhere I read about it it says startup command is optional. But when I deploy, it doesn't get further without this.
I have recently deployed other app services on windows and this was not the problem then. The startup command I am entering is dotnet <project.dll>. It deploys successfully. But after the deployment whenever I hit an API endpoint, it gives 500 Internal Server Error.
My question is:
What is the purpose of startup command? Why is this returns with 500 when deployed to linux.
S

It seems your startup command is correct refer to this.
You could check if this setting had been set already in Configuration, and check if the .dll file name is correct. As far as I known, this setting is necessary under Linux environment.
For 500 Internal Server Error, it's a error from server side, sometimes it means your web app is not prepared, and restart it would solve the problem.
If not solved, check the wwwroot file structure in kudu. ->.scm.azurewebsites.net If the file structure not correct, try another way to deploy.
Update
As your own reply, you connected your app to database. If issue still here, try add sql server policy like this:

I diagnosed the problem. My deployed app service is not whitelisted to access database. That is the reason for 500 Internal Server Error

Related

Error while Deploy Azure App Service : ERROR_COULD_NOT_CONNECT_TO_REMOTESVC

I am getting below error while deploying app service via Azure DevOps. I tried to search for this issue but could not found root cause of this.
Error :
2021-03-15T06:01:27.7479723Z ##[error]Error: Error Code: ERROR_COULD_NOT_CONNECT_TO_REMOTESVC
More Information: Could not connect to the remote computer ("web-app.scm.azurewebsites.net") using the specified process ("Web Management Service") because the server did not respond. Make sure that the process ("Web Management Service") is started on the remote computer. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.
Error: The remote server returned an error: (403) Forbidden.
Error count: 1.
'''
I tried everything until I spotted (after reading this) that my (dev) shared App Service service plan was out of storage space! When I upgraded it to a bigger one I could deploy again!
According to this document, the error is caused by that Web Deploy cannot connect to the remote service. Please refer to the follow points to troubleshoot your problem:
Please make sure Azure app service works fine. You can ping the remote machine.
That the msdepsvc(“Microsoft Web Deployment Agent Service”) or wmsvc(“Web Management Service”) service is started on the remote server.
Your firewall is not blocking incoming connections of your ports on the destination. If you used the default installation, then it would be 80 for msdepsvc and 8172 for wmsvc.
In addition, you could try to add -retryInterval:6000 -retryAttempts:10 to Additional Arguments in Azure App Service Deploy task as this thread stated.
BTW, if this issue still exists in Azure pipeline, please check if this issue exists locally. You could refer to this thread: Got 403 Error when doing Web Deployment and Web Deploy results in ERROR_COULD_NOT_CONNECT_TO_REMOTESVC for more guidance.
Thank you Edward for insightful explanation for possible root cause. Issue is resolved now.
Root cause was the agent pool selected did not have rights for deployment(IP are not whitelisted for production App service) since
We are not using agent provided by DevOps directly for production environment.
An instance that'd worked great for years starting giving me this error yesterday during Web Deploy. No changes from our side. No amount of poking around non-invasively solved it, but simply hitting the Restart button on the Azure app service Overview page put it to bed quite easily.
In short: Double-check your publish profile (each element).
Bit longer: In my case, my publish profile contained a ResourceGroup element which pointed to the wrong resource group. (I'm using WebPublishMethod: MSDeploy) I went over all elements and made sure they point to the correct resource, credentials and whatnot.
That seemed to solve the issue.
In my case, I had modified machine.config to captur traffic in Fiddler
<system.net>
<defaultProxy
enabled = "true"
useDefaultCredentials = "true">
<proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://127.0.0.1:8888" usesystemdefault="false" />
</defaultProxy>
</system.net>
and this was interfering with the VS deployment to Azure

How to diagnose AspNetCore application not starting on Azure App Service?

We have multiple AspNetCore applications hosted on an Azure Web App as OutOfProcess and deployed as virtual applications with separate paths.
We have the same setup in different environments, all infrastructure and applications are deployed automatically through our pipeline but it's only breaking in one environment and we can't find out why.
We have tried turning on stdoutLogEnabled to true. This reveals an invalid runtime.config.json error, I have read this can be caused by multiple issues but we can't identify any reason for it. We also intermittently see a 502.5 ANCM startup failure when navigating to the swagger URL for each application.
If we look in the application event logs in the Azure portal we are seeing this error failed to start process with command line 'dotnet .\<DLL>' with multiple retries. Failed to bind to port <PortNumber>
We can start the applications locally with Kudu by navigating to the location of the DLL and running dotnet <DLL>. The application starts successfully so it seems to be a problem on the web app. We've tried restarting and stopping and starting the web app, even tried scaling the app service to attempt getting a clean start but nothing has succeeded.
I'm not sure what other steps we can take to diagnose this issue or what we might have done wrong as the same applications are working fine in other environments.

Azure Error 403 this site is stopped

I have a asp.net mvc5 site running off a azure website, its running off a D1 shared infrastructure.
In the last couple of days I've had a few issues when deploying to it. Its at times been unable to deploy. (i've hashed out my site name)
Error 26 Web deployment task failed. (Could not connect to the remote
computer ("#####.scm.azurewebsites.net") using the specified process
("Web Management Service") because the server did not respond. Make
sure that the process ("Web Management Service") is started on the
remote computer. Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.)
And now when I deploy I'm getting
Error 403 - This web app is stopped.
. When I look in the azure portal it says the site is running and I cannot see anything in the ftp logfiles\http\rawlogs\ which would indicate this issue. i.e. I can just see 200 responses from then the site was last responding.
Restarting the site via the portal doesnt seem to make a difference.
How can i diagnose the cause of this problem? and is it possible that it could be related to any changes i have made to my application rather than a server infrastructure issue?
You may be running into Quota issues if your site is in SHARED mode. Please try upgrading to STANDARD mode.
Here is a screen shot:
I was having the same problem. Our site wasn't in shared mode and scaling up/down to another service plan helped for a moment but the problem quickly recurred.
Turned out the staging environment was bad.
To fix the problem, I had to swap, delete the staging slot, and then wait ~30 minutes before I could recreate it (got errors saying the hostname still existed).
I also had the same deployment problem from Azure Devops and the site wasn't in shared mode.
Failed to deploy web package to App Service.
Error Code: ERROR_COULD_NOT_CONNECT_TO_REMOTESVC
More Information: Could not connect to the remote computer ("######.scm.azurewebsites.net") using the specified process ("Web Management Service") because the server did not respond. Make sure that the process ("Web Management Service") is started on the remote computer. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.
Error: The remote server returned an error: (403) Forbidden.
Error count: 1.
Error: C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe failed with return code: 4294967295
I wasn't able to get to the Kudu site (######.scm.azurewebsites.net) from my local machine but I was able to from a JumpBox VM in our Azure subscription.
After inspecting the settings at resources.azure.com I noticed that under the "web" settings:
https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{SiteName}/config/web?api-version=2018-02-01
The "scmIpSecurityRestrictionsUseMain" value was set to "true". I set it back to "false" and was able to deploy and view Kudu locally again.

ThinkTecture IdentityServer on Azure

I used the following guide to set up IdentityServer for deploying to Azure: http://weblogs.thinktecture.com/cweyer/2013/01/running-thinktecture-identityserver-v2-in-a-windows-azure-web-role-from-zero-to-hero-a-walkthrough.html
I got all the way until actually running the Azure site locally, but when I attempt to start it, I receive a 500.19 error in IIS Express.
I have googled this error endlessly, but every solution has failed. Oddly, if I start IISExpress for the WebSite from the Command Prompt, I'm able to visit the site without issue. I'm certain this is an issue with the Azure Emulator, but I'm not sure how or why...
Thanks!

Access Azure Development Server From VM?

We are developing an application that we are deploying to Azure. It needs to work with a specific machine configuraiton. We we have this configured as a VM which developers can run locally.
However to test the VM configuration we need to publish to Azure and access it on a live Azure instance. Is there anyway to allow a local VM to get access to the Azure environment IIS on the developers machine? It doesn't seem to show up in IIS Express so I guess it isn't the same as a normal site?
Also is it possible to configure an Azure environment locally for testing. We want to host test applications for internal use and don't want them run on developers machines. We would like to run them on a server in the office.
Any ideas?
Thanks
I think that the answer to this question will outline the general guidelines you could follow to enable your environment.
Windows Azure Emulator has its own load balancer simulator which bind to socket 127.0.0.1:81 (most of the cases, if port 81 is free). If the Azure project is developed with Azure SDK 1.3 or later with Full IIS enabled, then the Azure Emulator (for versions 1.3 ~ 1.6) will use local IIS to host the sites. IIS Express is not involved in any way with the Azure project. If you happen to run IIS Express, then most probably you have set up your web application project as a StartUp project in the solution. The correct way to locally debug Windows Azure applications is to use the Cloud Project as a startup project.
Please kindly update your question, if there is some doubt or confusion after checking the mentioned related question.

Resources