I exported and downloaded my database from Azure as a .bacpac file.
I want to install Umbraco locally and use this database locally.
How do I do it?
Every time when I open the Microsoft SQL Server Management Studio it tries to connect to the database on Azure:
Then when I put the password it will connect to the database on Azure:
But I want to work on the local .bacpac file.
My questions are:
How do I connect on the Microsoft SQL Server Management Studio to the local .bacpac file ?
How do I connect in the Web.config to the local database ? What should I put in the connectionString?
<connectionStrings>
<remove name="umbracoDbDSN" />
<add name="umbracoDbDSN" connectionString="Server=tcp:xxxxx.database.windows.net,1433;Data Source=xxxxx.database.windows.net;Initial Catalog=xxxx;Persist Security Info=False;User ID=xxxx;Password=xxxx;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=3600;" providerName="System.Data.SqlClient" />
</connectionStrings>
So basically I want to open and work on the local .bacpac and not on the one on the server, and only after I finish the work to deploy it back.
How do I do it?
Thanks
Here are the steps that you should follow;
Connect to your local db.
Select Import Data-tier Application.
Select your .bacpac file.
Give a name to your new database and hit finish.
Create a new login or choose one of the existing ones and set the user mappings as follows so that you can connect to your new Umbraco db using this user's credentials.
And here is how you can connect to your local db from your local Umbraco website:
<add name="umbracoDbDSN" connectionString="server=localhost;database=YourNewUmbracoDbName;user id=youruser;password=yourpassword" providerName="System.Data.SqlClient" />
The .bacpac file is essentially a backup of another database, so you can't "open" or "connect" to it directly. You need to restore it on your local database server. Which, by the way, you might not have installed as it isn't part of Management Studio. When you open Management Studio you can just click Cancel on the Connect dialog that has your Azure server in it, and then maybe follow one of the many guides available via Google ;-) Like this one, maybe: https://www.netreo.com/microsoft-azure/how-to-restore-sql-azure-bacpac-to-local-sql-server/
Thanks a lot for your help!
I was able to install Umbraco locally.
Just one step I had to do before importing the database locally, is setup a local sql server, which I found a good explanation here:
Create Local SQL Server database
Create Local SQL Server database
Related
I am working with an mvc5 application in vs 2015.
I am getting errors whenever I attempt to access items from the database
Login failed for user '{your_username}'.
When I go azure portal "allow access to azure services" setting is on with my client Ip address listed.
I think my connection string is not configured correctly. I can't figure out how to correctly configure it on my local machine and with azure.
I have kept my the connection string in my web config to my local server which worked previously:
In my web.config
<add name="IdentityDbContext" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=C:\Users\UserName\EduSmart_db.Mdf; Initial Catalog=EduSmart_db;Integrated Security=True" providerName="System.Data.SqlClient" />
In Azure Portal connection string
Server=tcp:xxxx.database.windows.net,1433;Initial Catalog=Edu;Persist Security Info=False;User ID=Name;Password=Password;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
How can I tell which connection string azure is using?
Is there a different problem i have not considered?
How can I tell which connection string azure is using?
Azure use the second connection string. The first one(localdb) just used in your local machine. The server can not get it. You could add Azure Sql connection string name in Context class to specific it.
Is there a different problem i have not considered?
You could check from these ways:
1.The firewall settings in Azure Sql Database. Yo could define a
range of ip address(like ×.×.×.0 to ×.×.×.255) instead of only one ip
address.
2.You could check Azure sql connection string in web.configs file like
this. It works fine on my side.
<connectionStrings>
<add name="ConnectionStringName" providerName="System.Data.SqlClient" connectionString="Data Source=tcp:[databasename].database.windows.net,1433;Initial Catalog=[databasename];Integrated Security=False;User Id=[username];Password=[password];Encrypt=True;TrustServerCertificate=False;MultipleActiveResultSets=True" />
</connectionStrings>
If you use Code First for Azure Sql, you could add related connection string name in Context class:
public ApplicationDbContext(): base("ConnectionStringName")
{
}
3.You could click Tools>Connect to Database>Microsoft SQL
Server>enter your server name, username and password about Azure
Sql. Then click Test Connection button to check whether you could connect successfully.
Besides, you could refer this article to learn how to access Azure Sql in your project locally.
You just need to publish your Web app and database to Azure as explained here.
To publish your web app, right-click the project and select Publish. On the create a site page provide existing SQL Azure server, database and login credentials.
Two database connections will be provided when you publish, one of them is the DBContext. When you publish the Web site with the Wizard data tables are not published.
Since you have configured firewall settings on SQL Azure, to publish the database go to the database project. Right-click the project and select Publish. On the Publish Database dialog, click on Edit and update information regarding the database on Azure. Save the profile and publish the database.
I have successfully installed Umbraco on an App Service in Azure by using the following approach:
Visual Studio 2015 -> New empty Web Application
Installed current Umbraco nuget package
Published in a new Web App on Azure -> Works fine.
By default Umbraco uses SQL Server Compact Edition
<add name="umbracoDbDSN" connectionString="Data Source=|DataDirectory|\Umbraco.sdf;Flush Interval=1;" providerName="System.Data.SqlServerCe.4.0" />
To use an Azure DB backend I followed the following approach:
Create new Azure DB in Azure
Used SQL Server Compact & SQLite Toolbox to extract a SQL script from the Umbraco.sdf file
Executed the SQL script in my Azure DB
Changed the connection string in the Web.config
<add name="umbracoDbDSN" connectionString="Data Source=tcp:mysqlserver.database.windows.net,1433;Initial Catalog=umbraco-homepage;User ID=myuser;Password=mypassword;Connect Timeout=30;Encrypt=True;TrustServerCertificate=False" providerName="System.Data.SqlClient" />
Re-deployed the application with Visual Studio to my Azure Web App
When I open my web site Umbraco starts an upgrade and I receive the following error message:
What do I need to do to get Umbraco running with Azure DB? This guide seems to be outdated. The object "umbracoUserLogins" does not seem to exist (it was not necessary for SQL Server CE). How can I fix it?
Edit:
When I customise the Azure SQL connection I always get the error message "Could not connect to database". I tried to follow this guide. I typed in my server data like this:
Anything I forgot? Within the Visual Studio SQL Server Object Explorer I can reach the database.
My database configuration looks like this:
Choose "customize" during the setup and use the details from the connection string to fill in the connection data for SQL Server.
In order to restart the installer, remove the configuration status, set it like:
<add key="umbracoConfigurationStatus" value="" />
And empty out the connection string too:
<add name="umbracoDbDSN" connectionString="" providerName="" />
I want to create an MVC 5 project with Individual User Accounts authentication using Identity 2, and i want it to create a SQL Express database, instead of a localDb, using entity framework code first.
My connection string is as follows:
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\aspnet-MatWeb-20150821085043.mdf;User Instance=True;Initial Catalog=aspnet-MatWeb-20150821085043;Integrated Security=True" providerName="System.Data.SqlClient" />
When i run the web app, it launches properly and it let me register a new user, but if i try to check the database with SQL Server Management Studio, it doesn't appear anywhere.
So,
1.- Where is my database?
2.- Is it possible to make it visible with the SQL Server Management Studio? Or maybe change the database file path to make it searchable bu SQL Management Studio?
Thank you.
Since you attached your DB in connection string your DB is in App_Data folder of your project.
To manage your DB in Management Studio simply right click in Databases item in Object Explorer panel and choose Attach and add your DB file from App_Data
I have an MVC3 solution (EF 5/Net 4.5) that is connecting to a SQL Azure database. When I run the solution locally, it’s configured to connect up to the SQL Azure database, the solution works fine. However, when I publish the solution to Azure the connection to the SQL Azure database does not work.
It’s the same connection string in both the ServiceConfiguration.Cloud.csfg and ServiceConfiguration.Local.csfg files. I’ve also made sure that through the Azure portal the server that the Azure SQL DB is running on has “Windows Azure Services” as “Allowed Services” set to “Yes”
The connection string is:
<Setting name="SQLDataConnectionString" value="metadata=res://*/FooDB.csdl|res://*/FooDB.ssdl|res://*/FooDB.msl;provider=System.Data.SqlClient;provider connection string="Data Source=tcp:sahjjh7.database.windows.net,1433;Database=FooDB;User ID=<real user id>;Password=<real password>;Trusted_Connection=False;MultipleActiveResultSets=True;Encrypt=True;Connection Timeout=30;"" />
Any pointers?
Thanks!
I don't believe that Entity Framework knows how to grab connection strings from the ServiceConfiguration. Did you point it there yourself? If not, it could actually be an issue with a web.config transform.
I have two visual studio 2010 projects that I am running locally. One is a cloud project and connects to azure table (development) storage in addition to a local SQL Express, the other is not a cloud project. Both projects attempt to connect to a local SQL Express database via similar code generated through an xsd as well as directly in an aspx via a databound grid. The non-cloud project connects fine, but the cloud project fails with the common error:
"An attempt to attach an auto-named database for file C:\Users...mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share."
Both projects use the same connection string in a Web.config file:
<add name="WorkoutLogConnectionString1"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\...mdf;
Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
In VS2010 server explorer from the cloud project I can connect to the express database just fine, but when the project runs, it fails to connect. The cloud project also connects to a SQL Azure remote cloud database via another connection string in Web.config and that connection works fine.
I saw the MS support article: http://support.microsoft.com/kb/2002980 and thought that maybe the projects were originally created with different versions of VS and that maybe causing my issues, so I made the suggested IIS changes to the ASP.net 4.0 application pools, but to no avail.
Since the SQL Express connection string works in one project and not in the other I am stumped. Are there some other configuration elements or something related to the failing project being a cloud project that I should be looking at?
Are you tyring to run both the project simultaneously (at the same time - multiple startup projects). If so, it is indeed common issue with SQL Express. Often happens also when you have opened the database in your VS Server Explorer. If you have multiple applications accessing the same database, I suggest that you manually attach the database in your SQL Server Express. You can do by:
open SSMS (Sql Server Management Studio), connecting to your local SQL Express instance.
Navigate to Databases branch
Right click -> Attach Database
Browse to your mdf file
Done!
Now change your connection to the one suggested by Aaron. Generally I advice to now use the AttachDbFilename and UserInstance, but instead attach the database directly and use it as with a regular stand-alone instance of SQL Server. Saves lots of headaches.
Have you attached your database to an actual SQL Server Express instance? If so, remove all that AttachDbFilename and User Instance nonsense. To keep things simple and consistent you could probably use SQL Authenication locally. So you should just have something like:
<add name="WorkoutLogConnectionString1"
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=DatabaseName;
User ID=SQLAuthUsername;Password=password" providerName="System.Data.SqlClient" />