I have been playing around with Azure and am looking to publish my .net core 2 application there. So far, this builds on my local machine fine. I can register as a user, so I know everything is okay, locally. I can see users and have even managed to register certain users with certain claims.
I can publish the site to azure:
https://mytrade20180517093224.azurewebsites.net/
I can also log into the azure database from vs2017 using the same credentials I supplied in my appsettings.json. However, the problem I'm getting is my azure site then falls over when you go to register:
https://mytrade20180517093224.azurewebsites.net/Account/Register
I get:
502 - Web server received an invalid response while acting as a gateway or proxy server.
There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
The authentication type I have is the "individual user accounts" one, I have re-created the tables for this on the azure db I'm referencing. In the startup.cs I'm calling the "DefaultConnection" string if the environment is development and if its not (which I'm guessing Azure wont be by default) calling another connection string, the azure one:
if (HostingEnvironment.IsDevelopment())
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
}
else
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("azure")));
}
Does azure require something different to be done to pick the connection string? I tried to switch on the some kind of logging on azure but this didn't seem to make any difference. Any one, any clues as to what I could be potentially doing wrong?