?
Solved

Security feature in asp.net web site administration tool doesn't work.

Posted on 2011-09-18
2
Medium Priority
?
352 Views
Last Modified: 2012-05-27
Problem: every time I click on the “Security” icon in the asp.net Website Administration Tool, I get an “Unable to connect to SQL Server database” error. This error popped up 3 days ago and I can’t get rid of it.  VWD keeps on asking me to test the “Aspnetsqlprovider”.

I’m running VWD 2010 Express and SQL 2008 R2 Express. The SQL 2008 R2 server appears to be running properly. I am using Windows authentication. I can use the SQL 2008 R2 server to connect to the system databases and attach to other databases. The name of the server on SSMS is “HostComputer\SQLExpress”.

The code in the c:\windows\microsoft.net\framework\v4.0.30319\config\machine.config is as follows:
<connectionStrings>
		<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
	</connectionStrings>

Open in new window


In VWD, the Database Connection option has been set to: “.\SQLEXPRESS”.

I’ve used cmd.exe to set c:\windows\microsoft.net\framework\v4.0.30319\aspnet_regsql.exe to “.\SQLEXPRESS”. Coincidentally, whenever I run the asp.net SQL Server Wizard, it always points to “HostComputer”. Is that normal?

0
Comment
Question by:WhyDidntItWork
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Expert Comment

by:nishant joshi
ID: 36557097
0
 
LVL 3

Accepted Solution

by:
ExpertLogin_890 earned 2000 total points
ID: 36559170
First thing is try to use the web.config file for storing connection string instead of storing in machin.config and use the following things to resolve the issue

referred this link
http://www.dreamincode.net/forums/topic/229819-unable-to-connect-to-sql-server-database/

Or

1) Create a database in SQL Server (2000 or 2005) and make sure that you give the ASPNET account permissions to this database.
2) Run the aspnet_regsql.exe file in your System%Root\Microsoft.NET\Framework\v2.0.xyz directory.  This will open an ASP.NET SQL Server Setup Wizard which will create the objects necessary for ASP.NET security.
3) Point to the database you just created.
4) In your web.config file, locate the <connectionStrings> element and add the following:

<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Data Source=localhost;initial catalog=<your database name>;integrated security=true" providerName="System.Data.SqlClient">

This overrides the default SQL Express and points to the new database you just created - be it in the same machine or a different machine.  You can also change the configuration in the machine.config file although this will affect every web application sitting on top of your machine.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question