cannot access sql databases through iis using .net 1.1


Created a project using web matrix, when I run the application using web matrix server it works fine and my sql database get accessed and web pages are update with info from the sql database. Then I try running application using iis and the first web page displays correctly but when it tries to access the database to refresh the page with data from sql database it fails. Iget
Login failed for user 'AMD2200\ASPNET'.
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: Login failed for user 'AMD2200\ASPNET'.
Source Error:
Line 30 is in red.....
Line 28: dbCommand.Connection = dbConnection
Line 29: Dim dbReader as System.Data.IDataReader
Line 30: dbConnection.Open()
Line 31: dbReader = dbCommand.ExecuteReader()
Line 32: do while (dbReader.Read())


Any one have any ideas?
0
rbgreen
9/29/2003 11:33:39 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

4 Replies
602 Views

Similar Articles

[PageSpeed] 26

The problem is that you need to add the AMD2200/ASPNET Windows user to SQL Server (or MSDE).  If you have Enterprise Manager, this will be pretty easy.

Web Matrix runs your code under your security context, and so using Integrated security for SQL Server works for you. With IIS, your code is running in the ASPNET user context, by default.
Starting with ASP.NET 2.0? Look at:
Programming Microsoft Web Forms
My Blog
0
douglas
9/30/2003 12:57:51 AM

What if I do not have enterprise manager? Can I do it without it.
0
rbgreen
9/30/2003 4:37:23 AM

I installed enterprise manager and added aspnet as a user under secuity. I still get this error.
I did get a little further..

SELECT permission denied on object 'Customer', database 'PromShop1', owner '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 'Customer', database 'PromShop1', owner 'dbo'.
Source Error:

Line 153: dataAdapter.SelectCommand = dbCommand
Line 154: Dim dataSet As System.Data.DataSet = New System.Data.DataSet
Line 155: dataAdapter.Fill(dataSet)
Line 156:
Line 157: Return dataSet

0
rbgreen
9/30/2003 5:08:33 AM
In Enterprise Manager, you need to give the ASPNET user permissions to select (and optionally, insert if the app requires it) in the PromShop1 database.

Navigate to the tables the ASPNET user needs, right click on the table and select Properties from the context menu and click on Permissions and follow that dialog to grant permissions. Alternately, you can make the ASPNET user a member of the db_datareader and db_datawrite user groups (as required) by navigating to Users in the database and then right clicking on the ASPNET user.
Starting with ASP.NET 2.0? Look at:
Programming Microsoft Web Forms
My Blog
0
douglas
9/30/2003 9:04:41 AM
Reply: