0

I deployed a Asp.Net Core 2 application to Azure, using Visual Studio Community's Publish feature. The non-database-dependent parts of the application function, but the database-specific code returns an error.

The application's database is a Sql Server instance installed on a Windows server hosted on a Azure VM (not an Azure SQL database).

To fix this, I:

  • determined the application's IP address using the Url property (xxx.azurewebsites.net) of the app's blade
  • added an inbound rule to the network security group's blade that allows all ports from this IP address
  • added an entry to the VM's Windows firewall to allow ports from this IP address

Unfortunately, this did not solve the problem. What am I missing?

Incidentally, what's the recommended way to set the ASPNETCORE_ENVIRONMENT to development when publishing to Azure (to enable more-detailed error messages)?

craig
  • 25,664
  • 27
  • 119
  • 205
  • Regarding your second question, see [.Net Core - Set Environment Variable in Azure Deployment Task](https://stackoverflow.com/questions/38761617/net-core-set-environment-variable-in-azure-deployment-task). – laika Jan 12 '18 at 16:56

1 Answers1

0

I am assuming that your web application is deployed to an Azure Web App. You may not have the correct outbound IP address for your VM hosting. Note that a Web App's inbound IP address may be different from the Web App's outbound address. To find the outbound addresses for your Web App, do the following:

  1. Go to your Web App's management blade.
  2. Choose the Properties menu item (under Settings). On this screen, there's a list of possible outbound IP addresses. Try whitelisting them all in your VM's firewall.
Rob Reagan
  • 7,313
  • 3
  • 20
  • 49