开发者

working with sql server 2008

开发者 https://www.devze.com 2022-12-19 17:08 出处:网络
I am not used to work with SQL Server(usually I just use express). I run it on windows server 2008, iis7.

I am not used to work with SQL Server(usually I just use express). I run it on windows server 2008, iis7.

I have attached the database to my sql server. I made a web site in iis7 but I get this error message.

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

Connectionstring 开发者_如何学PythonI use

<add key="PhaetonConnectionString" value="Data Source=.;Initial Catalog=Phaeton.mdf;Integrated Security=True"/> 

Thanks


Since you are using Integrated Security the SQL connection will use the windows identity which is passed from ASP.NET.

You can either change your security to mixed-mode which will involve removing the integrated security. Or use impersonation (check IIS and your web.config) and grant that user access to the database.

Hope that helps


You need to configure your application in IIS to turn off anonymous access and turn on Windows authentication(If yoy want to use integrated security).

Access SQL Server Using Windows Integrated Security

The other way, you can use a connection string with user/password ... with the appropriate login


Problem was that the database I tried to attach was sql express


The problem is here:

Initial Catalog=Phaeton.mdf

In SQL Server Express, you can attach a filename as a local database. That's not how it works on a production SQL Server. In non-Express versions you attach a database permanently, which it looks like you've already done, and you give it a logical name, which is not the same as the primary file name.

I would guess that if the file name was "Phaeton.mdf" then you probably named the database "Phaeton". In which case that part of the connection string should simply be:

Initial Catalog=Phaeton

If that's not the right name, you can get a list of database names from the server using the following script:

USE master;
SELECT name FROM sys.databases
0

精彩评论

暂无评论...
验证码 换一张
取 消