Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #21 (permalink)  
Old March 7th, 2006, 02:19 PM
Registered User
 
Join Date: Mar 2006
Location: Austin, , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok so after getting SqlExpress up and running again and then going in and attempting to switch it over to SqlServer2005 I am getting:

CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:\Local Source Code\WroxUnited\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Which makes sence becuase aspnetdb is the default name for the roles database that is created whenusing aspnet_regsql.exe. So this program can't be run on a server that has run that utility. Maybe if wrox wrote the program to use a differnt db for roles then it could work?

At this point in time I think the program just can't run on sql server 2005. I was using this as a learning experience and I've leardned a lot but it took too much time. If wrox could figure this out it would have saved me a ton of time and made the first impression of the book positive.

(the aspnet_sqlreg.exe link again is: http://msdn.microsoft.com/asp.net/de...aspnet_sql.asp)


  #22 (permalink)  
Old March 11th, 2006, 09:31 AM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi gperrego,

It sounds to me like you're on the right track to get it working. You might try deleting the existing aspnetdb.mdf, that would get rid of the error message you're getting telling you that it already exists. If you want to try that, here is how:

I believe SQLExpress does not come with a graphical interface, so you will have to use the command line utility, sqlcmd.

Go to a command prompt.
Type this: sqlcmd -S .\SQLExpress
You should get a prompt that looks like this: 1>
Type this: exec sp_databases
Press enter and then type : go
Press enter.
This will list all the databases currently attached to your sql express instance.
If you see the aspnetdb in the list, then delete it like this:
1>DROP DATABASE aspnetdb
2>GO

When you are done, type exit and press enter. The database should be deleted.

Hope this helps. If it doesn't, post back.

Mike

  #23 (permalink)  
Old May 5th, 2006, 12:30 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to lcolmenarez
Default

Hi Everyone -

I've had the same problem of getting the site to work. I think I have joy though... the site seems to be working! :) I had the same error message (error: 26 - Error Locating Server/Instance Specified) posted here and elsewhere.

Here is my config:
XP Home
VS2005
SQLServer Enterprise 2005 (upgrade from SqlExpress: NOTE THIS IS IMPORTANT!)

Anyway I had trouble getting the site to run and I followed Chris' advice:
1. Add the [machine\ASPNET] and [NT AUTHORITY\NETWORK SERVICE] as logins
2. Attach the database (wroxunited.mdf), makeing ASPNET the db_owner
3. Add [machine\ASPNET] and [NT AUTHORITY\NETWORK SERVICE] as database users
4 Change the connection strings in web.config. That should be all for the WroxUnited database - then there's the providers, which can either be added to WroxUnited db or to a separate one.
5. Run aspnet_regsql (in the framework directory), to add the user/roles/etc tables/procs to he appropriate datbase
6. Add provider sections in web.config, for <membership>, <roles>, <profile>, setting the default provider for each to the new provider added. These providers should point at the ConnectionString for the database (so either WroxUnited or a new conn str if using another database).

I had no problem adding NT Authority\Network Service. The trick for adding this user is pretend that "Network Service" is part of the local machine domain, and don't use "NT Authority" as a domain.

I also had problems with steps 5 and 6. After much consternation and research on MSDN, I discovered some legacy code from SQL Express that wanted to link ASP2.0 to a non-existent SQL Express database in my machine.config file! Argh! :(

Here is a snippet from my modified machine.config:

  <connectionStrings>

    <add name="LocalSqlServer" connectionString="data source=tlaloc2;Integrated Security=SSPI;Initial Catalog=ASPNET2.0" providerName="System.Data.SqlClient" />
  </connectionStrings>

So basically I modified the connection string to reflect the database I set with aspnet_regsql utility.

Hope this helps!

Luis

  #24 (permalink)  
Old May 24th, 2006, 07:45 PM
Authorized User
 
Join Date: Dec 2004
Location: , , USA.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to bettyb1656
Default

I'm still having problems.
I added the logins [machine\ASPNET] and [NT AUTHORITY\NETWORK SERVICE] to the 2005 server.
I attached the wroxunited.mdf database as WROXUNITED with [machine/ASPNET] as db owner.
There were several database users after the wroxunited database was attached, including the following:
user [NT AUTHORITY\NETWORK SERVICE] with [NT AUTHORITY\NETWORK SERVICE] as the login and owning schema [NT AUTHORITY\NETWORK SERVICE]
user ASPNET with no login name specified and owning no schema. When looking at the properties for ASPNET user I must cancel not click OK as OK gives the error that a login name must be entered.

I can delete user ASPNET and try to add [machine\ASPNET] but I cannot use login name [machine\ASPNET] as that is the login for dbo.

When I run WroxUnited from IIS 5.1 I get Server Error in '/WroxUnited' Application. Login failed for user '(null'). Reason: Not associated with a trusted SQL Server.

I did modify the connection string in web.config but I don't know if it is correct.

Any ideas?

  #25 (permalink)  
Old May 25th, 2006, 03:44 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

The error message you get seems to suggest your connection string does not use Integrated Security, but SQL Server security instead. Take a look at this site: http://www.connectionstrings.com/

Then expand SQL Server 2005 and then SqlConnection (.NET). Next, make sure your connection string looks like the one listed under "Trusted Connection", and not like the one listed under "Standard Security".

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
  #26 (permalink)  
Old May 25th, 2006, 03:05 PM
Authorized User
 
Join Date: Dec 2004
Location: , , USA.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to bettyb1656
Default

Thanks, Imar.
I made a couple of changes to the connection string, which now looks like this:

    <connectionStrings>
        <remove name="LocalSqlServer"/>
        <add name="LocalSqlServer"
      connectionString="Data Source=server\instance;
            Initial Catalog=WROXUNITED
            Integrated Security=SSPI;"
      providerName="System.Data.SqlClient" />
    </connectionStrings>

The error I now get is:

Login failed for user ''. Reason: The user is not associated with a trusted SQL Server connection.

I believe the problem is with the database user ASPNET not being associated with a login and/or not being able to add user [machine\ASPNET]

Thanks for the info, BettyB.



  #27 (permalink)  
Old May 25th, 2006, 03:58 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Usually you get this error when you try to connect to a SQL Server that only allows Windows Authentication, but you use SQL Authentication in the connection string.

Is server\instance in your connection string, or was that just an example?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
  #28 (permalink)  
Old May 25th, 2006, 05:36 PM
Authorized User
 
Join Date: Dec 2004
Location: , , USA.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to bettyb1656
Default

server\instance is just an example. The rest of the connection string is copied from web.config file. I have an instance of SQL Server 2Ks and a named instance of 2005 on the machine.

BettyB.
www.flamingo-code.com
  #29 (permalink)  
Old May 26th, 2006, 03:29 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi BettyB,

Are you sure you configured the right application and the right web.config? The error indicates a connection with SQL Server authentication.

Have you seen this blog post before? http://weblogs.asp.net/scottgu/archi...25/423703.aspx

It may not directly fix your problems, but it may give you some insight in configuring your applications and SQL Server.

It is very possible to connect to a SQL Server 2005 database from any .NET web app. The reason why the Express edition is used so often because a) it's free, b) it's pretty easy to use and configure. Configuring a true SQL Server database can be a bit more tricky, and also requires a bit more knowledge about the network and your machines.

If I find the time over the next days / week, I'll try to write an article about it on my site....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
  #30 (permalink)  
Old May 26th, 2006, 03:57 PM
Authorized User
 
Join Date: Dec 2004
Location: , , USA.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to bettyb1656
Default

Hi Imar,

I'm not sure what your first question means. Most of the configuration that I am having problems with occurs in SQL Server. I am using SSMS. The problems I have are with the server logins, WroxUnited database owner and database users. I am not aware of anything at this point that specifies the application I am going to use. There is only one web.config per application AFAIK. The Wrox United application is where I have changed the connection string in the web.config. When I logon to my server in SSMS I logon with Windows authentication. Do I need to change my connection string? Using info from ConnectionStrings.com I tried to set up the connection string as SqlConnect (.NET) | Trusted Connection.

I understand that 'Configuring a true SQL Server database can be a bit more tricky' but I doubt that using SQL Server Express to work my way thru the beginning ASP.NET book will give me the information to enable me to use true SQL Server 2005. Of course, I may be wrong.

I have looked at the blog post but didn't think it answered any of the login|db owner|db user conflicts that I am having. I will go through it again.

Thanks

--
BettyB.
www.flamingo-code.com
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
reg conn to sql server 2005 from vb.net 2005.. veda SQL Server 2005 2 July 1st, 2008 12:16 AM
Wrox.com SQL Server 2005 Articles jminatel SQL Server 2005 6 April 10th, 2008 08:59 AM
SQL SERVER 2005 STANDARD (not express) proslambano BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 8 January 8th, 2007 08:55 PM
no wrox books on sql server 2005 connect2sandeep SQL Server 2000 4 September 1st, 2005 02:24 PM
Can we install SQL Server on WinXP Pro? dotnetwhizkid SQL Server 2000 6 August 26th, 2003 03:33 AM



All times are GMT -4. The time now is 09:35 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.