No database connection when trying to use IIS locally with asp.net MVC 1.0
Posted
by mark4asp
on Stack Overflow
See other posts from Stack Overflow
or by mark4asp
Published on 2010-04-01T15:49:42Z
Indexed on
2010/04/01
15:53 UTC
Read the original article
Hit count: 187
Login failed for user ''. The user is not associated with a trusted SQL Server connection.
When I try to use IIS locally instead of Cassini I get this error.
The ASP.NET MVC 1.0 site is running on WinXP.
The database is local and has SQL Server and Windows Authentification mode enabled.
The website runs OK using Cassini, with the same connection string.
It fails when I try to use IIS instead of Cassini.
These permissions are set on the Virtual directory which IIS points to. ASP.NET Machine Account [Full Control] Internet Guest Account [Full Control] System [Full Control]
This virtual directory is the same are the directory holding my project files.
I am using Linq and the database connection string is stored in the App.config file of my data project. I get the same error whether I set the connection string to use Windows or Sql server authentification.
My sql server has both [MyMachineName\ASPNET] and SqlServerUser Logins and a User on the database.
CREATE LOGIN [MyMachineName\ASPNET] FROM WINDOWS WITH DEFAULT_DATABASE=[master],
DEFAULT_LANGUAGE=[us_english]
Use My_database
CREATE USER [MyMachineName\ASPNET] FOR LOGIN [MyMachineName\ASPNET]
WITH DEFAULT_SCHEMA=[dbo]
CREATE LOGIN [MwMvcLg] WITH PASSWORD=N'blahblah', DEFAULT_DATABASE=[master],
DEFAULT_LANGUAGE=[British], CHECK_EXPIRATION=OFF, CHECK_POLICY=ON
Use My_database
CREATE USER [MwMvcLg] FOR LOGIN [MwMvcLg] WITH DEFAULT_SCHEMA=[dbo]
How come I have no problem running this website on IIS6 remotely. Why does IIS5.1, running locally, need these extra logins?
PS: My overwhelming preference is to use Sql Server authentification - as this is how it runs when deployed.
© Stack Overflow or respective owner