Solved

Major problems with Microsoft SQL Server and Permissions!

Posted on 2006-10-30
19
5,039 Views
Last Modified: 2008-04-17
I am trying to set up SQL state for ASP.NET on a Windows 2003 server with MS SQL server 2005. I am getting this error:

Cannot open database "ASPState" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

1) I have created the ASPSstate database using the prefered Microsoft Methods.
2) This is my connection string in the web.config:
              <sessionState
                            mode="SQLServer"
                              sqlConnectionString="Server=MyServer;Database=ASPState;Integrated ecurity=SSPI;Trusted_Connection=Yes"
                              allowCustomSqlDatabase="true"
                              cookieless="false"
                               />
3) Then just to get this puppy working I ran this query to give the permission to NT AUTHORITY\NETWORK SERVICE, which is what i thought sql wanted.

use aspstate

sp_changedbowner 'NT AUTHORITY\NETWORK SERVICE',true

4) I then go this error "SELECT permission denied on object 'ASPStateTempApplications'" which I reseached and found that this is the fix (beause of SQL and SP3 apparently you have to jump through this hoop)

use master
go
EXEC sp_configure 'Cross DB Ownership Chaining', '0'; RECONFIGURE
go

use master
go
EXEC sp_dboption 'ASPState' , 'db chaining', 'true'
go

5) OK restarted SQL server and this didn't work at all. I also tried assigned permissions to SA but sql didnt like that and wouldn't let me login.

The goal here is to use SSI or integrated security so i dont have to have the SA password in the web.config. PLEASE HELP ME BEFORE I TURN A SHOTGUN ON MYSELF!!

- jenni
0
Comment
Question by:JenniQ
19 Comments
 
LVL 3

Author Comment

by:JenniQ
ID: 17836274
HEre is  a little more detailed error message:

SELECT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.
SELECT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.
INSERT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: SELECT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.
SELECT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.
INSERT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.

Thank you thank you thank you!
0
 
LVL 4

Expert Comment

by:hclgroup
ID: 17836762
Why don't you just create the user and assign permissions through Enterprise Manager?
0
 
LVL 3

Author Comment

by:JenniQ
ID: 17837348
I tried... obviously i dont know what Im doing. Can you give me a little more info ?
0
 
LVL 10

Expert Comment

by:AaronAbend
ID: 17839061
go to start-> programs-> Microsoft SQL 2005 -> SQL Server Management Studio. You should be able to connect to your database there. Check the security tab for your login, and check the databases tab and your databaes (ASPState) to make sure that user is listed as having permission, and right mouse to see the permissions granted on each table. tho DBO should give you everything you need.

I am not an ASP guy - not sure what else could cause the problem
0
 
LVL 3

Author Comment

by:JenniQ
ID: 17846459
Thank you so much for your post!!

OK so I log into SQL 2005 Managment Studio. Under the SERVERNAME / SECURITY / LOGINS tree node I see the account SA. I double clikc on SA and then choose the User Mapping tab to see some databases that have been checked. I put a check next to ASPState and click ok and I get the message:

Create failed for User 'sa'.  (Microsoft.SqlServer.Smo)
Cannot use the special principal 'sa'. (Microsoft SQL Server, Error: 15405)

I look at the NETWORK SERVICE user, which is what ASPState is complaining about, and it is already mapped to that ASPState Database. (ASPState has DBO as the User on this page)

Next, I go to the ASPState database then go to security/users. I see DBO in this node. THere are two sections; Owned Schemas and Database Role Memebeship.

For Owned Scheam everythign is grey checked (you konw when the box is gray but there is acheck.) this includes a lot of stuff like db_denydataReader etc which I can't uncheck...

Under Database rol memebership the db_owner is checked.

The ASPState database has no tables.

THANK YOU SO MUCH in advance for your help! this problem is really killing me....

Thakn you thank you thank you!

-- Jenni




0
 
LVL 3

Author Comment

by:JenniQ
ID: 17862119
Anyone? :(
0
 
LVL 3

Author Comment

by:JenniQ
ID: 17922481
still looking for help!
0
 
LVL 10

Expert Comment

by:AaronAbend
ID: 17922541
Jenni I don't have the asp expertise to help.  Let's do this. I will post another question as a pointer to this one. Sometimes when questions get old and experts see another expert helping, they go on to help other people and a question gets stale before it gets answered. In this case, it may be that not a lot of SQL guys have ASP as well.  Since your question did not emphasize that, I will repost with an emphasis on that aspect of the issue.

Let's see if we can get you the help you need.
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17922560
>Cannot open database "ASPState" requested by the login. The login failed.
>Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

this means that the login can connect to the sql server, but not to the database.
reason: the login has not been mapped to a user in the database, ie no permissions are granted to the login in that database, hence, the error you see.

solution:
 open the properties of the login, and go to the tab to grant access to the database ASPState.


0
 
LVL 10

Expert Comment

by:AaronAbend
ID: 17922568
By the way, you will see that I asked the question by simply posting your error message "Cannot open database "ASPState" requested by the login"

Your question "major problem with permissions" suggests that the problem has to do with permissions. It is best not to assume the nature of a problem. Just post the error you are getting, since an expert who recognizes that message can help you immediately, whereas "major problem with permissions" does not necessarily help an expert determine whether a question is within their expertise.  
0
 
LVL 28

Expert Comment

by:imran_fast
ID: 17928242
hi JenniQ,
First check what is the user in IIS security tab.
Second check that whether or not that user have access in sql server on the specific database

Regards

Imran
0
 
LVL 10

Expert Comment

by:AaronAbend
ID: 17962076
JenniQ,

Imran has posted some info for you... If there is no additional post by Monday 11/20 I will be closing my pointer questions. Please either close the question and ask for a refund (and maybe repost in the asp area) or follow up with Imran.

Thanks
0
 
LVL 3

Author Comment

by:JenniQ
ID: 17984257
Hey Guys,

Thanks for your response. Please let me look this question over tonight and see if I can solve it based off these answers, then I will decied if I wanna close it or open a new Q.

Thanks guys!

-- JenniQ
0
 
LVL 3

Author Comment

by:JenniQ
ID: 17985030
Aaron. Thank you for your help posting a pointer to this question! I will take your advice when posting in the future.

Imran -- the ASPSTATE database has no  IIS website associated with it.

I followed tried giving the login user full dbo permissions and am recieve this error now:

SELECT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.
SELECT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.
INSERT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.

I'm just going to try to uninstalling ASPSTATE from this server and re installing. I have a feeling something is wrong wit the installation.

Thank you for your help again!!

0
 
LVL 3

Author Comment

by:JenniQ
ID: 19073857
I never received an answer - I gave up on this problem.....
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 19251917
PAQed with points refunded (350)

Computer101
EE Admin
0
 

Expert Comment

by:bruceshining
ID: 21382568
There is no "Accepted Solution", but I saw a great response by Angelll (ranked Genius) that helped me.
I have copied it here:

>Cannot open database "ASPState" requested by the login. The login failed.
>Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

this means that the login can connect to the sql server, but not to the database.
reason: the login has not been mapped to a user in the database, ie no permissions are granted to the login in that database, hence, the error you see.

solution:
 open the properties of the login, and go to the tab to grant access to the database ASPState.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In today’s complex data management environments, it is not unusual for UNIX servers to be dedicated to a particular department, purpose, or database.  As a result, a SAS® data analyst often works with multiple servers, each with its own data storage…
Creating and Managing Databases with phpMyAdmin in cPanel.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now