Solved

Major problems with Microsoft SQL Server and Permissions!

Posted on 2006-10-30
19
5,020 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
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…

707 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

12 Experts available now in Live!

Get 1:1 Help Now