Base solution for your next web application
Open Closed

Deploying ASP.NET Boilerplate To AZURE #1115


User avatar
0
okeziestanley created

Hi guys who has ever deployed an ASP.NET Boilerplate website successfully. I just deploy one to azure cloud recently and first I had to deploy the Debug mode instead of Release mode. The Release mode kept failing. Also I can transfer the data on the local database to the remote database on Azure. The remote database starts out empty


8 Answer(s)
  • User Avatar
    0
    david created

    Hi,

    It is fairly easy with azure web app service. You have to create a web app service with a database linked. Then you download publish profile, insert into visual studio and publish. To perform the migrations to azure db you can change the connection string in web config temporarily, or target it during update-database command(Update-Database -ConnectionStringName "AzureConnectionString").

    Dont forget to white list your ip in order to perform migrations.

  • User Avatar
    0
    guillaumej created

    Everytime I deploy to Azure AND the application is running (in Azure), I got an error "Web deployment task failed") because it can't suppress Logs.txt (locked by a process)

    I can change by removing the "Suppress extra files during publish", but it seems to me that having the logs.txt file locked is wrong.

  • User Avatar
    0
    guillaumemorin created

    Can you put your Logs.txt into your App_Data folder, then you can check 'Exclude files from the App_Data folder' option on publish.

  • User Avatar
    0
    joemo created

    If its the log4net file thats locking, I had the same problem. You can get around it by adding this line to log4net.config before the </appender> line:-

    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />

  • User Avatar
    0
    guillaumej created

    <cite>joemo: </cite> If its the log4net file thats locking, I had the same problem. You can get around it by adding this line to log4net.config before the </appender> line:-

    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />

    Thanks !

  • User Avatar
    0
    justinp created

    <cite>David: </cite> Hi,

    It is fairly easy with azure web app service. You have to create a web app service with a database linked. Then you download publish profile, insert into visual studio and publish. To perform the migrations to azure db you can change the connection string in web config temporarily, or target it during update-database command(Update-Database -ConnectionStringName "AzureConnectionString").

    Dont forget to white list your ip in order to perform migrations.

    David,

    Thank you for this reply. I'm evaluating aspnetboilerplate with the zero module in order to determine if aspnetzero will be worth the investment to start building a SaaS product. I'm posting a lengthy reply to help anyone that is having the same issue, but also to walk through what I've tried to get where I am. Any help would be appreciated.

    I have gotten the default boilerplate application (asp.net core) to work by downloading and adding a SQLDatabase project and pointing the appsettings to that database. It runs as expected locally. I have not made any changes to the project.

    It looks very promising, but I simply cannot get this running in Azure. I get a 500 response. I've looked into it for a couple hours and still cannot resolve the issue.

    I have tried what you posted above, including updating my appsettings.json connection string to point to my azure sql database, but it did not resolve the issue.

    I also tried moving from a Free plan to a Basic plan so I can target the x64 platform and updated Target DNX version to x64 (see this post: <a class="postlink" href="https://github.com/pauldotknopf/react-aspnet-boilerplate/issues/10">https://github.com/pauldotknopf/react-a ... /issues/10</a>). However, this still did not work.

    After getting nowhere with the log files, I ran the application locally, but with the connection string to my azure database. This gave me a different error, which looks like an aspboilerplate error: ApplicationException: No language defined!

    That makes sense because I never ran the Update-Database command against the SQL database on Azure. So far, so good. Finally, when I try to update the database using the command you posted I get the following:

    PM> Update-Database -ConnectionStringName "Default" Exception calling "SetData" with "2" argument(s): "Type 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject' in assembly 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation, Version=14.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable." At C:\Users\Justin.nuget\packages\EntityFramework\6.1.3\tools\EntityFramework.psm1:718 char:5

    • $domain.SetData('project', $project)
      
    • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
      • FullyQualifiedErrorId : SerializationException

    Exception calling "SetData" with "2" argument(s): "Type 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject' in assembly 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation, Version=14.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable." At C:\Users\Justin.nuget\packages\EntityFramework\6.1.3\tools\EntityFramework.psm1:719 char:5

    • $domain.SetData('contextProject', $contextProject)
      
    • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
      • FullyQualifiedErrorId : SerializationException

    Exception calling "SetData" with "2" argument(s): "Type 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject' in assembly 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation, Version=14.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable." At C:\Users\Justin.nuget\packages\EntityFramework\6.1.3\tools\EntityFramework.psm1:720 char:5

    • $domain.SetData('startUpProject', $startUpProject)
      
    • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
      • FullyQualifiedErrorId : SerializationException

    System.NullReferenceException: Object reference not set to an instance of an object. at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T](Project project, String propertyName) at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory) at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0() at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) Object reference not set to an instance of an object.

    Thanks,

    Justin

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi Justin,

    Thank you for your detailed explanation. You need to run migrations in order to run the application but it seems like Visual Studio cannot do it from your local machine to azure db somehow.

    Can you try to do it with Migrator tool included in your solution ?

  • User Avatar
    0
    ron created

    Hi Justin,

    Great to see you are exploring the ABP framework with Azure. Actually I have deployed an ABP project with Module Zero on Azure Web App & Azure SQL sever for few months.

    Let's share more on your progress. :D