Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 9th, 2007, 08:11 AM
Registered User
 
Join Date: May 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with connection to .MDF file

I am writing a small application in ASP .NET (designed for intranet use in one company). I decided to use the Roles system provided by ASP .NET. It functions as expected on my development machine. When I tried to deploy it on another machine (the would-be intranet server), I got an error on the first line trying to access the Roles object:
---
SqlException (0x80131904): Fehler beim Herstellen einer Verbindung mit dem Server. Beim Herstellen einer Verbindung mit SQL Server 2005 kann dieser Fehler dadurch verursacht werden, dass unter den SQL Server-Standardeinstellungen Remoteverbindungen nicht zulässig sind. (provider: SQL-Netzwerkschnittstellen, error: 26 - Fehler beim Bestimmen des angegebenen Servers/der angegebenen Instanz)]
---
This means: Error when building a connection to the server. When using SQL Server 2005, a possible cause is that the SQL Server-standard configuration does not allow remote connections. (provider: SQL-networkintrerfaces, error: 26-error when determining the given server/the given instance)

When I looked into the application, I saw that ASP has built its own database called ASPNETDB.MDF, and the connection to it works on my PC only, but not on any PC I copy it to. The connection string to it is not visible in the web.config or anywhere else. I can configure the connection using Visual Studio 2005, but I don't have VS installed on the server. The connection uses Windows authentification (I can't set it to SQL authentification, because I don't have SQL server and thus cannot open the MDF and manage its users). I found on the Internet that one possible cause for connection errors can be that the property "user instance" is set to "true", but when I set it to false, I got an error message telling me that I cannot open the database aspnet.mdf, because another user or process has already opened it.
At first I thought that maybe the path to the database does not change when copying to the server, but when I copied the application to the server, I used the same path (actually the standard inetpub\wwwroot path). Besides, if I delete the database on the server, I get another error (and if I delete it on the development machine, asp creates the database again). But then maybe ASP tries to maintain the connection to the database copy on my development machine, and this could be the reason for this "does not allow remote connections" in the error text. I can't know it as I can't see the connection string it builds. Then I thought that access rights caused the problem. Just to test it, I gave all possible accounts (my own, ASPNET, IIS, IUSER etc) full access rights to the application folder, to App_Data folder, and to the .mdf file itself. Nothing happened, the error message didn't change. I read an article on this site about connecting asp .net files to .mdf databases, but it didn't help, as there the author assumed that the developer creates and manages his database using the SQL Server, but in my case, I cannot change anything on the database. A thing I tried was to add <identity impersonate="true"> to my web.config, but it didn't help. Now I am totally confused and consider managing roles through strings stored in session variables like I did it under classic ASP, but I would rather use the .NET functionality, so please give me ideas how to make it work...

Reply With Quote
  #2 (permalink)  
Old May 9th, 2007, 08:17 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...
first quick question.. do you have SQL 2005 express installed on the server???

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Reply With Quote
  #3 (permalink)  
Old May 9th, 2007, 09:47 AM
Registered User
 
Join Date: May 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No, I don't have any SQL 2005 software licenses. It is not installed on the server, and not on the development machine. But I assume that the .NET Framework (or whatever made the database, maybe Visual Studio did it for me) knows how to configure it so it works. Other Internet posts on this topic suggest that there is a problem with the connection string, but as I don't know where it is hidden, I cannot see if it is correct or not.

Reply With Quote
  #4 (permalink)  
Old May 9th, 2007, 10:12 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

well.. my first thinking is that besides you don't have any license for SQL 2005 there is a free version of it (SQL 2005 express) (allowing a maximum of 5 concurrent connections at a time)...
I don't know how this work on your develop machine, but i don't think is nothing to do with connection string since the database is always be looked in the app_data folder...
Take in mind that visual studio install some kind of driver that let you connect to sql 2005 files (since you can see it in the server explorer) so an idea is to try to install sql 2005 express on the server (or in a test machine to be really sure)...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Reply With Quote
  #5 (permalink)  
Old May 11th, 2007, 02:34 AM
Registered User
 
Join Date: May 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for the information, gbianchi. It took me the whole day yesterday to get an admin install the SQL Server on a test machine. Now it works like a dream.

The problem is, you mentioned that SQL Express only supports 5 connections at a given time. I expect to have about 15-20 users for my app and it is very probable that they will all open it at the same time. So the Express doesn't seem to be the right option. And I don't know if the users will like it if the application requires an installation of a full SQL Server on their server. Maybe I'll stick to session variables for role management, as I only have 2 roles it isn't very hard to implement.

Reply With Quote
  #6 (permalink)  
Old May 11th, 2007, 07:34 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

well.. you better first try the app. since you have no much users and the role database has not heavy work on it...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Reply With Quote
  #7 (permalink)  
Old May 16th, 2007, 07:33 AM
Registered User
 
Join Date: May 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to GCeaser
Default

I would just like to make a point that SQL Server 2005 Express DOES NOT limit the maximum number of connections to 5 concurrent connections at a time. It does however limit the SQL Server 2005 Express instance to utlize only 1 CPU and up to 1 GB of RAM.

Reply With Quote
  #8 (permalink)  
Old May 16th, 2007, 08:12 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

you are rigth.. I had bad info or maybe old...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Reply With Quote
Reply


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
How to import .MDF file into SQL Server Enterprise shong BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 4 July 23rd, 2008 11:51 AM
Problem connecting to ASPNETDB.MDF file nikitos1979 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 April 24th, 2008 09:55 AM
how to open database file of .mdf extension ravi.gurgaon BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 August 19th, 2006 05:09 AM
problem with mdf file Rahil SQL Server 2000 2 April 29th, 2004 11:03 PM



All times are GMT -4. The time now is 11:20 AM.


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