问题描述:

I am following a tutorial to learn how to use form based security in ASP.NET but i got stuck at step 3, when i have to create the create the membership database. I am a newbie, could you give me a hand?

This is the tutorial i am following: http://msdn.microsoft.com/en-us/library/ff649314.aspx

And this is my problem:

Just in case the image is small, the error says:

An error has occurred. Details of the

exception: A network-related or

instance-specific error occurred while

establishing a conne ction to SQL

Server. The server was not found or

was not accessible. Verify that the

instance name is correct and that SQL

Server is configured to allow remote

connections. (provider: Named Pipes

Provider, error: 40 - Could not open a

conne ction to SQL Server)

Could someone more experienced, help me solving this? I already posted a similar question today, but i cant fix it, i don't understand what i should do.

Ill appreciate a lot your help.

UPDATE

I tried to verified the connection as recommended in this link:

http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.ii.doc/opt/tlsmss08.htm

But something goes wrong:

UPDATE 2

I followed sehe's suggestion and i made the query for retrieving the date pass. So i assumed i was connected. The next thing i did was, try to grant database access as says in the tutorial, but i cant make the queries pass:

This are the queries just incase the image is small:

-- Create a SQL Server login for the Network Service account sp_grantlogin

'NT AUTHORITY\Network Service'

-- Grant the login access to the membership database USE aspnetdb GO

sp_grantdbaccess 'NT AUTHORITY\Network

Service', 'Network Service'

-- Add user to database role USE aspnetdb GO sp_addrolemember

'aspnet_Membership_FullAccess',

'Network Service'

Only the first one seem to pass ok.

Any suggestions?

网友答案:

The key phrase would be:

Unable to connect to SQL Server database.

So make sure

  • you have installed an SQL (Express) database, and find out the instance name. Usually SqlExpress
  • that it is configured for TCP Access
  • that (local) is working as an alias

A few ideas to try

  • run the script (the command window) as Admin
  • replace (local) with .\SqlExpress
  • run ASPNET_RegSQl without any parameters. IIRC it will start a GUI with a Wizard.
相关阅读:
Top