I'm trying to publish my solution to Azure but I have I'm not able to get it to work. I have followed the same instructions from this tutorial: <a class="postlink" href="https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-dotnet-sqldatabase">https://docs.microsoft.com/en-us/azure/ ... qldatabase</a>.
I get this error message on the page: "An error occurred while starting the application. SqlException: Invalid object name 'AbpEditions'. System.Data.SqlClient.SqlConnection.OnError(SqlException exception, bool breakConnection, Action<Action> wrapCloseInAction)
SqlException: Invalid object name 'AbpEditions'."
This is because the database was not created.
Is there anything I have to configure in the appsettings file or other places to get this to work?
8 Answer(s)
-
0
<cite>affern: </cite> I'm trying to publish my solution to Azure but I have I'm not able to get it to work. I have followed the same instructions from this tutorial: <a class="postlink" href="https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-dotnet-sqldatabase">https://docs.microsoft.com/en-us/azure/ ... qldatabase</a>.
I get this error message on the page: "An error occurred while starting the application. SqlException: Invalid object name 'AbpEditions'. System.Data.SqlClient.SqlConnection.OnError(SqlException exception, bool breakConnection, Action<Action> wrapCloseInAction)
SqlException: Invalid object name 'AbpEditions'."
This is because the database was not created.
Is there anything I have to configure in the appsettings file or other places to get this to work?
I found this information on a site: "Using Code First Migrations to Deploy the Database To deploy the database you'll use Code First Migrations. When you create the publish profile that you use to configure settings for deploying from Visual Studio, you'll select a check box labeled Update Database. This setting causes the deployment process to automatically configure the application Web.config file on the destination server so that Code First uses the MigrateDatabaseToLatestVersion initializer class."
But I don't get any checkbox for Update database in the wizard. I'm running the publish wizard from the solution.web.host project.
-
0
Try running the migrator app and point it to your Azure DB.
-
0
@BBakerMMC, why do you always answer questions JUST before I to? I know, I know, you are on AU time right?
:-)
-
0
Thanks! Now I have my database in Azure.
But now I get an "500 - The request timed out" error message.
I have followed these steps:
- Created a web application on azure.
- Created a database on azure.
- I added the database connection string for azure DB and put it in the Migrator project's appsettings.json and migrated the azure DB with migration tool. And I added my computer's public IP address to azure sql database's firewall list.
- Then I published the Host project to my app service on azure using Visual Studio's publish tool.
- I configured appsettings.Production.json for Host website (ConnectionString and WebSiteRootAddress)
Is there anyone here who has any suggestions to what I can do to move on?
-
0
From the application log: <h3>HTTP Error 502.5 - Bad Gateway</h3> <h4>The specified CGI application encountered an error and the server terminated the process.</h4> </div> <div class="content-container"> <fieldset><h4>Most likely causes:</h4> <ul> <li>The CGI application did not return a valid set of HTTP errors.</li> <li>A server acting as a proxy or gateway was unable to process the request due to an error in a parent gateway.</li> </ul> </fieldset> </div> <div class="content-container"> <fieldset><h4>Things you can try:</h4> <ul> <li>Use DebugDiag to troubleshoot the CGI application.</li> <li>Determine if a proxy or gateway is responsible for this error.</li> </ul> </fieldset> </div>
<div class="content-container"> <fieldset><h4>Detailed Error Information:</h4> <div id="details-left"> <table border="0" cellpadding="0" cellspacing="0"> <tr class="alt"><th>Module</th><td> AspNetCoreModule</td></tr> <tr><th>Notification</th><td> ExecuteRequestHandler</td></tr> <tr class="alt"><th>Handler</th><td> aspNetCore</td></tr> <tr><th>Error Code</th><td> 0x00000000</td></tr> </table> </div> <div id="details-right"> <table border="0" cellpadding="0" cellspacing="0"> <tr class="alt"><th>Requested URL</th><td> http://ZeroAppWebHost20180107:80/favicon.ico</td></tr> <tr><th>Physical Path</th><td> D:\home\site\wwwroot\favicon.ico</td></tr> <tr class="alt"><th>Logon Method</th><td> Anonymous</td></tr> <tr><th>Logon User</th><td> Anonymous</td></tr>
</table> <div class="clear"></div> </div> </fieldset> </div> <div class="content-container"> <fieldset><h4>More Information:</h4> This error occurs when a CGI application does not return a valid set of HTTP headers, or when a proxy or gateway was unable to send the request to a parent gateway. You may need to get a network trace or contact the proxy server administrator, if it is not a CGI problem. </fieldset>
-
0
Hi @affern,
Can you check if there is any Log file created under the published website ? It can contain a detailed message for this error. Your steps seems normal by the way.
-
0
I reinstalled everything and now it works. Thanks :)
-
0
Great :)