Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 24th, 2006, 12:07 AM
Authorized User
 
Join Date: Feb 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Moving db to SQL Server 2005 for deployment

Hi,
   Let me first say that I have worked through the book and found it very useful and informative. I kind of feel like the deployment chapter left me hanging, though, and I have a couple of questions. We use SQLExpress as the development database. Almost universally, these apps will be deployed on a full-blown SQL Server.

Question 1: The login control looks to some provider, which then presumably looks for the aspnetdb as it's data store. If I deploy my app on a server w/ SQL Server 2005, what do I need to modify in order to get it to work? I did some experimenting with the machine.config file and changed the connection string to one specific to SQL Server (replaced "./SQLExpress" with "(local)", removed User Instance=True), but that did not help.

Question 2: Is there any advantage (other than portability of the files) to keeping the databases in the app_data folder and only attaching them when the app requests it (for example, filling a gridview from a SQLDataSource)? Why not just attach them to the SQL Server instance manually? What happens when multiple users are accessing the web site? If two different instances of the web site are both attempting to attach the database at the same time, what happens? Does the first attempt succeed and the second fail, because the database is already attached, or does the provider recognized the db is attached and just continue on?

I appreciate any feedback or suggestions.

Thanks,

Mike
 
Old February 24th, 2006, 11:27 AM
Authorized User
 
Join Date: Feb 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
   I have managed to find an answer to Question 1. Look here:

http://weblogs.asp.net/scottgu/archi...25/423703.aspx

This blog describes how to remove the default connection string for the membership provider which specifies the SQLExpress instance and add a connection string (with the same name) that points to your local SQL Server 2005 instance.

What you are looking for is about 3/4 of the way down the page-> a description of modifying the web.config file. You can skip most of the steps in the post, as they are just instructions on how to create the database. We already have the database in the app-data folder, so we don't need to create it. (When you build your own app, however, the rest of the post will come in handy as it documents the steps to create and configure the database.)
Here is an extraction:

    <connectionStrings>

        <remove name=”LocalSqlServer”/>

        <add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=appservicesdb;Integrated Security=True" providerName="System.Data.SqlClient"/>

    </connectionStrings>

*note the database name the author of the blog used is "appservicesdb". You will need to substitute the name of your database, probably aspnetdb. Also, instead of "Data Source=localhost", I used "Data Source=(local)". May not make a difference.

I made this work. I attached the database to SQL Server manually, and then made the changes mentioned in the post.

I hope this helps some people. I know it helped me.

Mike



 
Old March 2nd, 2006, 07:49 AM
Wrox Author
 
Join Date: Jun 2004
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Mike,
        The SQL Server deployment bit is of course a great idea, I would have included that if I had thought of it. In hindsight it's obvious of course :-). Perhaps it's because I'm used to running SQL 2k developer edition, and to deploy on SQL 2k full version requires minimal changes. I suspect it's too late to change for the C# edition, but I might see if I can add a section on this for future editions of the book.

Chris

Chris Ullman
Programmer/Technical Author
http://www.cuasp.co.uk
 
Old March 2nd, 2006, 07:59 AM
Wrox Author
 
Join Date: Jun 2004
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

RE: Question 2 - in some circumstances (not necessarily these circumstances), you will get an error when trying to attach, the first attempt will succeed and the second will fail. We have had some experience of this with technical reviewers of the chapters.

App_Data is mainly there for portability, also ASPNET 2.0 restricts direct access to the folder as well so there is some security involved too - so you can put xml and sitemap files in there as well. Also any database added to App_Data becomes available within Server Explorer and when you deploy your site, any database within App_Data is deployed to the main site.

Does this answer your question?

Chris

Chris Ullman
Programmer/Technical Author
http://www.cuasp.co.uk
 
Old March 3rd, 2006, 01:52 PM
Authorized User
 
Join Date: Feb 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, it does. Thank you.

I can see the advantage of having the database in the app_data folder. It seems to be most helpful during development. It also seems to be a good place for the sitemap files, as you pointed out in your post.

Thanks,

Mike





Similar Threads
Thread Thread Starter Forum Replies Last Post
can't access db in sql server 2005 brillox BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 3 May 3rd, 2007 05:15 PM
MS ACCESS 2003 FRONTEND AND MS SQL SERVER 2005 DB mohankumar0709 SQL Server 2005 3 March 23rd, 2007 12:48 AM
Issues moving to SQL 2005 Server iPagan BOOK: Accessible XHTML and CSS Web Sites: Problem Design Solution 1 January 17th, 2007 01:35 PM
Moving to SQL Server siptah Access VBA 4 January 27th, 2005 07:28 PM
moving a SQL Server v7 db file lcsgeek Classic ASP Databases 1 May 5th, 2004 01:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.