I have a website built with ASP MVC5.
Also I use Entity Framework 6 with Database First approach and edmx.
On production I already have database with a lot of data.
I'm using TeamCity for CI and would like to perform auto deployments.
I found Web Deployments and also tried to configure Publish profiles.
But 1 have some questions:
1. What about database? how to migrate, upgrade schema and data automatically? Are there any tools for that?
2. Could you describe how publish via Web Deploy works? I see connection string definition, etc. How it copies files to remote box, and how applies DB (schema, data migration?)
3. Also I configured IIS website for FTP upload deployment. How it connected with previous cases?
Related
I'm testing an application I just published using the free option that Azure gives us.
In this process I found out that I need to make a change to a Controller (ASP.NET Core 2.0) and I've been looking for the options to do so.
I've encountered with Azure App Service Editor and I'm reading some documentation about it. However, it does not seem the way to do this kind of change since I can't access the *.cs files thru this service. This is the list of files that are shown:
So, my question is:
Is there a way to edit these files (controllers, views) with Azure App Service Editor?
If no, what would be the way to reflect this changes on my already published application? Also, in the case the answer is "republish the project", is it possible to do so without alter the information contained in the database that has been added during this test process and only update the modified files?
I apoligize if these questions are very basic but I'm just getting started to know about Azure. Thanks in advance.
How I publish it:
In order to publish this project I used the option Visual Studio gives us:
Now, if I go to the same option, this windows shows up:
Question: If I hit the 'Publish' button I believe it will republish, the whole project, correct (the database included)? If this is the case, I believe there will be conflicts about the databases, since I have already information in the project published and other information in the local project. Is it possible to reflect the update for everything but the databases?
No, you can't update the files there as this is a compiled web app, so you have to publish the update.
I'm assuming you're using EntityFramework and originally publishing the database via the web publish.
If you click "settings" on the publish dialogue, on the second page (settings tab) you'll see the options for publishing the database.
Here you'll see options as to whether to update the database during deployment, this I believe is to apply migrations. But if you uncheck these it should not update your database at all.
You should verify this after saving the publish by looking at the generated publish profile (you don't have to do a publish to see this)
It will be located at "YourApp\Properties\PublishProfiles" and should have been added to your solution, and will be called something like "Your App - Web Deploy.pubxml"
Within this you will see a <PublishDatabaseSettings> section, where the Enabled properties should be set to False
However I would advice that before publishing any update:
Test the deployment to a new server
Back up the database before deploying and test you can restore from it.
I'm learning how to write application in ASP.NET Core 2.0. I'm following the "code first approach" where I first create a model of my tables and then add a migration to build the database.
What is still unclear to me is how should I deploy the application to the server. I mean, I'm able to publish it to a folder and add it to the IIS on the remote machine.
But what about the database?
In details:
should I re-build the database on the server or I have to manually copy the one on the development machine?
what are the requisites for the server? I have to install any specific driver?
My connection string is:
"Server=(localdb)\\mssqllocaldb;Database=HelloWorld;Trusted_Connection=True;MultipleActiveResultSets=true"
and I'm using Visual Studio 2017.
I have uploaded the website files using the publishing wizard in Visual Studio. I used FTP to transfer those files. Now I'm not sure how to get my databases hooked up.
I used Code First Migrations in Entity Framework for my databases. I have three databases in my project that have been stored locally. I am trying to add them through cPanel. HostGator is the provider.
I have created 3 MySQL databases in cPanel, but I'm not sure where to go from there and I'm having trouble finding information online.
here is how you can create the DB in code first migration:
https://stackoverflow.com/a/16322232/2072676
hope it helps
Can we add hyperlink on web deploy tool which check on my server following prerequisite?
1..Net Framework 4.5 installed or not.
2. MVC framework installed or not.
3. Connectivity to database server from Web Server.
My application is in MVC 2?
You could create a batch script to assert these things and run it from the prompt:
msdeploy.exe -preSync="myAssertions.bat" ...
the preSync command will be executed on the remote server. Note: the batch file you will execute here needs to reside on the server because as the command specifies; preSync no syncing has happened yet.
More information about the preSync provider: http://technet.microsoft.com/en-us/library/ee619740(v=ws.10).aspx
Ive been working on a project on my computer and i want to transfer it to my laptop. The project is an ASP.Net Website Project in C#. I'm using SQL Server 2012 to hold my database and the Asp.net user management tables in my database also.
What's the easiest way to do this, as i have backed up my database and copied the ASP.net website folder onto my laptop and changed data source, but I'm getting a few errors, especially on the asp.net configuration page it has also removed my roles due to the transferring.
If i understood you correct, what you need is to deploy the ASP.NET Membership Database to the new project location. There are set of tools and commands that you need to use.
You would need to construct a command-line like the following:
C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe" -verb:sync
-source:dbfullsql=" [your connection string] "
-dest:dbfullsql="c:\temp\InsertIntoAspNetDB.sql
Again the exact path and command will depend on your local configuration.
You may get more detailed information from MSDN - How to: Deploy a Database With a Web Application Project