I don't know how can I deploy my local Umbraco 7.2 local website to a normal server (Windows 2012 VPS). I know I need to copy all files to the server, but I can't figure out how can I copy the database. I download an SQL Management Studio 2012, but I don't know the access details, because when I installed the site to my localhost, the installer didn't ask me. Maybe on thing, as I remember, the DB type. It was SQL CE.
Does anybody know how can I access to the local and server database? Whats is Umbraco database name?
Is there any else configuration?
Maybe an easier option to deploy?
You can:
Open the database \App_Data\Umbraco.sdf see How do you open an SDF file (SQL Server Compact Edition)? (it is not in new SQL Management Studio versions) and do your database things to deploy.
Copy the SQL CE default \App_Data\Umbraco.sdf
Create a package
Using tools like Courier
And see the web.config for your connectionString:
<connectionStrings>
<remove name="umbracoDbDSN" />
<add name="umbracoDbDSN" connectionString="Data Source=|DataDirectory|\Umbraco.sdf;Flush Interval=1;" providerName="System.Data.SqlServerCe.4.0" />
<!-- Important: If you're upgrading Umbraco, do not clear the connection string / provider name during your web.config merge. -->
</connectionStrings>
Related
I've recently starting learning asp.net and MVC and would be grateful for some clarification on working with data in an application. More specifically, what is the difference between adding a new sql server database item to the App_Data folder and creating a database connection in the Server Explorer window? If I add a new database in the App_Data folder am I still able to work with this database in SSMS or I can I only work with it through Visual Studio?
Thanks
If you have the *.mdf placed in App_Data folder
<connectionStrings>
<add name="ConnectionName"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|DatabaseName.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
it will work if you change your file location.
server explorer connection will be static.
where do I find a database that has this connection string (it's not appearing in my local sql server list yet does exist as a sample app I'm using is creating data in it)
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;
LocalDB is a tool for .NET developers to develop datbases without the overhead of setting up sql server. You can view information about the LocalDb instances using the utility SqlLocalDb.exe found here http://technet.microsoft.com/en-us/library/hh212961.aspx
I am getting the following error whenever I am trying to open the db_name.mdf file:
The database '{path}\db_name.MDF' cannot be opened because it is version 706. This server supports version 662 and earlier. A downgrade path is not supported. Could not open new database 'db_name.MDF'. CREATE DATABASE is aborted. An attempt to attach an auto-named database for file {$path}\db_name.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Connection string as follows:
<add name="PasswordDBContext" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\db_name.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />
I am working on a asp.net mvc 4 project within visual studio.
Any help to get the issue resolved are very much appreciated. Thanks.
LocalDB is a new feature introduced in SQL 2012 Express - you will need to install SQL 2012 Express LocalDb if you need to use an MDF in this manner.
Krzysztof Kozielczyk has blogged several entries around on LocalDB here - take note especially of the issues when running under 'Full IIS'.
IMO using LocalDb with ASP.NET is for a developer machine config only - i.e. when you are ready to deploy your (code first?) MVC 4 app to a testing or production environment, you should consider attaching ASPNETDB.MDF more permanently to a SQL Instance.
You cannot attach a MVC 4 localDB in SQL Server 2012 Management Studio. You'll need to connect directly.
Open up SQL Server 2012 Management Studio. You can download a free express version here:
http://www.microsoft.com/en-us/download/details.aspx?id=29062
During installation make sure you check the localDB component to be installed.
After installation, open Management Studio and the "Connect to Server" dialog will appear.
Enter (LocalDb)\v11.0 in the Server Name textbox. Use windows authentication and click connect.
Your asp database will show in the manager. You can then script it out to what ever you want and edit the DB and make the appropriate changes to your connection strings in your web config.
Remember that if you're using Code First, which in VS 2013's MVC Internet template uses, you'll need to check your db creation code in your app start folder.
LocalDB was created so you can create data driven web applications without the overhead of a full version of SQL server running on your development machine. When you deploy to a production server, migrate to a full SQL Server instance.
Hope this helps :)
Set your database connection string to your Locally installed DB is as below.
Web.config :
<add name="ContextName" connectionString="Data Source=ServerName;Initial Catalog=DBCatalogName;Integrated Security=True;MultipleActiveResultSets=True;App=EntityFramework"
providerName="System.Data.SqlClient" />
I have a C# app written using Entity Framework 4.3.1.0 that talks to a SQL Server 2008 user instance on my development machine in Visual Studio 2010. It also works on my laptop in Visual Studio. But on the customers desktop PC, with SQL Server 2008 R2 I can't connect to the database with the application. The error is
The underlying provider failed on Open
All three computers are Windows 7 64-bit, but the app is 32 bit.
I suspected the connection string in myapp.exe.config, but it is the same as the one I use in Visual Studio.
In doing the research I have come up with two possibilities.
Does the same connection string work with SQL Server 2008 and SQL Server 2008 R2?
Does the location of the .mdf / .ldf files matter, I initially installed them in the application folder, but there may be a better place, like a predefinded AllUsersAppData. Is the application folder read-only for the server files?
Here is the ConnectionStrings section from app.config. I don't know if both are required.
<connectionStrings>
<add name="DataClass.Properties.Settings.SWDatabaseEntities" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\SWDatabase.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
<add name="SWDatabaseEntities" connectionString="metadata=res://*/SWDatabaseModel.csdl|res://*/SWDatabaseModel.ssdl|res://*/SWDatabaseModel.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\SWDatabase.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
It started working for some reason after I removed an errant from mcahine.config that an IBM Client had installed. It didn't work right away, but I don't know what else changed. Maybe it was after a reboot.
Good day once more.
Okay so what I want to do is to keep my database in the App_Data folder for ease of use, now I thought this would be easy: Copy the database into the folder and change the connection string. But when I try that I get the horrible version error:
The database
'C:\USERS\GUÐMUNDUR\DESKTOP\TEST\TEST\APP_DATA\IRIS2.MDF'
cannot be opened because it is version
661. This server supports version 655 and earlier. A downgrade path is not
supported. Could not open new database
'C:\USERS\GUÐMUNDUR\DESKTOP\TEST\TEST\APP_DATA\IRIS2.MDF'.
CREATE DATABASE is aborted. An attempt
to attach an auto-named database for
file
C:\Users\Guðmundur\Desktop\Test\Test\App_Data\IRIS2.mdf
failed. A database with the same name
exists, or specified file cannot be
opened, or it is located on UNC share.
Now I was wondering if anyone can suggest a solution to this, I can recreate the database via the SQL script so there is no problem with that and there is no important (yet) information there.
Any ideas?
Here is the connection string:
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|IRIS2.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
The solution I used
I went into the SQL Server Management Studio and attached the database there while keeping it in the App_Data folder. Than I went into Visual Studio, created a new Data Connection and after it was created I clicked on it and went into Properties tab for it and selected everything from the Connection String and replaced what I originally had with it.
So the connection string looks like this now:
<connectionStrings>
<add name="ApplicationServices"
connectionString="Data Source=WODAN;Initial Catalog=IRIS;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
Here are the instructions for the attachment process (as supplied by Ladislav Mrnka)
msdn.microsoft.com/en-us/library/ms190209.aspx
Thanks to everyone for their input and special thanks for Ladislav for helping me through out.
It means that your .mdf file was created by newer version of SQL Server. 661 should be SQL Server 2008 R2 and you are probably using only SQL Server 2008 (that is the version you can install as part of Visual Studio 2010 installation).
Version 655 is SQL 2008. 661 is 2008 R2. The box doesn't know how to handle the newer version.
In the Add Connection dialog, click on the Advanced.. button. Find the Data Source property and make sure the drop down matches the instance you're using.
Jumping in Late. Here is what I found.
One might have both 2008 and 2008 R2 Installed on their system. But if you see the error saying it cannot open 661 version, then update your SQL Server Express to 2008 R2. It will fix the issue.
MDF files can be opened directly in your visual studio as long as your are using express edition of SQL server.