<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Another Programmer&#039;s Blog &#187; App_Data</title>
	<atom:link href="http://www.daringa.com/archives/tag/app_data/feed" rel="self" type="application/rss+xml" />
	<link>http://www.daringa.com</link>
	<description>.NET, C#, MSSQL Server, Windows 8</description>
	<lastBuildDate>Wed, 16 Jul 2025 16:35:02 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>How to Move MSSQL Server Express Data From Development/Testing Servers to Production</title>
		<link>http://www.daringa.com/archives/48</link>
		<comments>http://www.daringa.com/archives/48#comments</comments>
		<pubDate>Thu, 06 Dec 2012 19:09:54 +0000</pubDate>
		<dc:creator>bogdan</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[App_Data]]></category>
		<category><![CDATA[move to production]]></category>
		<category><![CDATA[sql server 2008]]></category>
		<category><![CDATA[sql server express 2008]]></category>

		<guid isPermaLink="false">http://blog.daringa.com/?p=48</guid>
		<description><![CDATA[Step by step procedure of how to move MSSQL Server Express App_Data files to SQL Server 2008 R2. Current environment settings are MSSQL Server Express and SQL Server 2008 R2. This particular move process is done on the MVC Music app sample from Microsoft, but it works the same way on any Web application. Some [...]]]></description>
				<content:encoded><![CDATA[<p><strong>Step by step procedure of how to move MSSQL Server Express App_Data files to SQL Server 2008 R2.</strong></p>
<div></div>
<p>Current environment settings are MSSQL Server Express and SQL Server 2008 R2.</p>
<p style="text-align: left;">This particular move process is done on the MVC Music app sample from Microsoft, but it works the same way on any Web application.<br />
Some Hints:</p>
<ul>
<li><span style="text-align: center;">Make sure that Application is not open VS2010 in my case &#8211; no handles on the files to be moved.</span></li>
<li><span style="text-align: center;">One database has to two files ( MDF and LDF).</span></li>
</ul>
<p><strong><span style="text-align: center;">Start here:</span></strong></p>
<ul>
<li>Go to Application folder i.e. my case is D:\Projects\MvcMusicStore\App_Data and find the files to be transferred like the ones bellow:</li>
<li><a href="http://blog.daringa.com/wp-content/uploads/2012/12/transferedFiles1.jpg"><img class="alignnone size-full wp-image-60" title="transferedFiles" src="http://blog.daringa.com/wp-content/uploads/2012/12/transferedFiles1.jpg" alt="" width="564" height="68" /></a></li>
<li>Next step is to go to the target folder where SQL 2008R2 stores data base files.</li>
</ul>
<ul>
<li>Open SQL Server Management Studio. Download it from <a title="Microsoft® SQL Server® 2008 Management Studio Express" href="http://www.microsoft.com/en-us/download/details.aspx?id=7593" target="_blank">here</a> if you don&#8217;t have it  installed.</li>
<li>Connect to the target server with the appropriate username and password, preferably the sa password.</li>
<li>Right click Database folder and select Attach…</li>
<li></li>
<li><a href="http://blog.daringa.com/wp-content/uploads/2012/12/Attach.jpg"><img class="alignnone size-full wp-image-54" title="Attach" src="http://blog.daringa.com/wp-content/uploads/2012/12/Attach.jpg" alt="" width="360" height="228" /></a></li>
<li>On the next pop up window by selecting Add.</li>
<li><a href="http://blog.daringa.com/wp-content/uploads/2012/12/Add.png"><img class="alignnone  wp-image-59" title="Add" src="http://blog.daringa.com/wp-content/uploads/2012/12/Add.png" alt="" width="360" height="228" /></a></li>
<li>The Location of Database files is specified on the picture bellow. In my case : <span style="color: #ff0000;">C:\Program Files\Microsoft SQL Server\MSSQL10_50.DEEQLSERVER2008\MSSQL\DATA</span></li>
<li><span style="color: #000000;">Press Cancel.</span></li>
<li><span style="color: #000000;">At this point stop the service of the 2 instances MSSQL server 2008 R2 and MSSQL Server Express.</span></li>
<li><span style="color: #000000;">Copy the files from App_Data and paste them into:</span></li>
<li><span style="color: #000000;"><span style="color: #ff0000;">C:\Program Files\Microsoft SQL Server\MSSQL10_50.DEEQLSERVER2008\MSSQL\DATA</span> .</span></li>
<li><span style="color: #000000;">Right click Database folder and select Attach…</span></li>
<li><span style="color: #000000;">Click on the MDF file name to be attached.</span></li>
<li>When the attachment process is done Click OK.</li>
<li>The name of the attached database is the file path, rename to a better one.</li>
</ul>
<p>First part is done. Now we have to change to web.config file.</p>
<p>Note Line 4 and 5.</p>
<pre class="brush: xml; gutter: true">&lt;connectionStrings&gt;
    &lt;add name=&quot;ApplicationServices&quot; 
    	connectionString=&quot;data source=.\SQLEXPRESS;
    	Integrated Security=SSPI;
    	AttachDBFilename=|DataDirectory|aspnetdb.mdf;
    	User Instance=true&quot; providerName=&quot;System.Data.SqlClient&quot; /&gt;
    &lt;add name=&quot;WebStoreEntities&quot; 
    	connectionString=&quot;metadata=res://*/WebStoreEntities.csdl|res://*/WebStoreEntities.ssdl|res://*/WebStoreEntities.msl;
    	provider=System.Data.SqlClient;
    	provider connection string=&amp;quot;
    	Data Source=.\SQLEXPRESS;
    	AttachDbFilename=|DataDirectory|\MVCMusicStore.mdf;
    	Integrated Security=True;
    	User Instance=True;
    	MultipleActiveResultSets=True&amp;quot;&quot; 
    	providerName=&quot;System.Data.EntityClient&quot; /&gt;
&lt;/connectionStrings&gt;</pre>
<p>Below the new connection string. Pay attention at  line 4,  5,  7, 8, 9, 10.</p>
<pre class="brush: xml; gutter: true">&lt;connectionStrings&gt;
    &lt;add name=&quot;ApplicationServices&quot; connectionString=&quot;data source=.\MYSQLSERVER2008;           
         Initial Catalog=aspnetdb;           
         User ID=myUserName;           
         Password=myPassword;&quot;
         providerName=&quot;System.Data.SqlClient&quot; /&gt;
    &lt;add name=&quot;MusicStoreEntities&quot; connectionString=&quot;data source=.\MYSQLSERVER2008;        
         initial catalog=Mvc3Music;               
         User ID=myUserName;               
         Password=myPassword;&quot; 
         providerName=&quot;System.Data.SqlClient&quot; /&gt;
&lt;/connectionStrings&gt;</pre>
<p>end:</p>
<p>Also, make sure that &lt;system.web&gt; node has the following:</p>
<pre class="brush: xml; gutter: true">&lt;authentication mode=&quot;Forms&quot;&gt;
      &lt;forms loginUrl=&quot;~/Account/LogOn&quot; timeout=&quot;2880&quot; /&gt;
&lt;/authentication&gt;

&lt;membership&gt;
	&lt;providers&gt;
  	&lt;clear /&gt;
	    &lt;add name=&quot;AspNetSqlMembershipProvider&quot; 
	    type=&quot;System.Web.Security.SqlMembershipProvider&quot; 
	    connectionStringName=&quot;ApplicationServices&quot; 
	    enablePasswordRetrieval=&quot;false&quot; 
	    enablePasswordReset=&quot;true&quot; 
	    requiresQuestionAndAnswer=&quot;false&quot; 
	    requiresUniqueEmail=&quot;false&quot; 
	    maxInvalidPasswordAttempts=&quot;5&quot; 
	    minRequiredPasswordLength=&quot;6&quot; 
	    minRequiredNonalphanumericCharacters=&quot;0&quot; 
	    passwordAttemptWindow=&quot;10&quot; 
	    applicationName=&quot;/&quot; /&gt;
	&lt;/providers&gt;
&lt;/membership&gt;

&lt;profile&gt;
	&lt;providers&gt;
  	&lt;clear /&gt;
    &lt;add name=&quot;AspNetSqlProfileProvider&quot; 
    type=&quot;System.Web.Profile.SqlProfileProvider&quot; 
    connectionStringName=&quot;ApplicationServices&quot; 
    applicationName=&quot;/&quot; /&gt;
	&lt;/providers&gt;
&lt;/profile&gt;

&lt;roleManager enabled=&quot;true&quot;&gt;
	&lt;providers&gt;
  	&lt;clear /&gt;
    &lt;add connectionStringName=&quot;ApplicationServices&quot; 
    	applicationName=&quot;/&quot; 
     	name=&quot;AspNetSqlRoleProvider&quot; 
      type=&quot;System.Web.Security.SqlRoleProvider&quot; /&gt;
      &lt;add applicationName=&quot;/&quot; 
      name=&quot;AspNetWindowsTokenRoleProvider&quot; 
      type=&quot;System.Web.Security.WindowsTokenRoleProvider&quot; /&gt;
  &lt;/providers&gt;
&lt;/roleManager&gt;</pre>
<p>End</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daringa.com/archives/48/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
