Monday, November 15, 2010

Visual Studio 2010 and SQL Server 2008

When creating ASP.NET 4.0 application using VS 2010 with SQL Server 2008, by default, the ASP.Net 4.0 users does not have the right permission to access SQL server database. Following the below step to assign the proper user.
1. In IIS Manager, go to the website and in the IIS section, select the Authentication icon and open it. You should have a list of authentications. Right-click on Anonymous Authentication and select Edit. this should be set to Application pool identity.
2. Go to the Application Pools and select the pool your website is in. In the listing, you should see the Identity column. It should be set to LocalSystem. If not, then right-click on the pool and select Advanced Settings. Under the Process Model section, set the Identity to NetworkService by clicking the button on the right-side of the text box and in the dialog, using the Built-in account dropdownlist

In addition, the sqlDatasource wizard may get an invalid object error. Apply the following steps to correct the error.
SQL server 2005 uses a "Schema.Table" naming convention that VS2010 SQLDataSource Wizard doesn't pickup. To workaround the issue, instead of "Specify columns from table or view", select "Specify a custom SQL statement...". On the next screen, use the "Query Builder" to generate the SQL statement. It will pickup the schema name.

No comments:

Post a Comment