开发者

ASP.NET MVC2.0 remote SQL server - Login failed for user '<username>'. Reason: Not associated with a trusted SQL Server connection

first I have checked that Server Authentication is already set to:

"SQL server and Windows Authentication mode" (mixed mode)

้here 's my web.config connec开发者_如何学Pythontionstring

<connectionStrings>
    <add name="StockConnectionString" connectionString="Data Source=192.168.0.2;Initial Catalog=Stock;Persist Security Info=True;User ID=op;Password=operator" providerName="System.Data.SqlClient"/>
</connectionStrings>

Whene I test running (ctrl+F5) under VS2010 development this can connect to remote SQL server without any problem. but when i publish this project to local IIS (same web.config) an error occured..

Login failed for user 'op'. Reason: Not associated with a trusted SQL Server connection.

also i can connect to SQL server via SQL server Management Studio with SQL server authentication same user/pass.

no idea what's wrong with this.


finally, after 3 days can't figure this out. then i tried start over.

created a new project (ASP.NET MVC 2 web app) in VS2010. go to Database Explorer > Add Connection..

use SQL server authentication to remote SQLserver directly instead of local.

then gotcha!! it told me..

this server version is not supported. you must have Microsoft SQL server 2005 or later.

my project was created under Win XP connect to SQLserver 2000 and it's work fine. now the answer for an error above is..

Visual Studio 2010 dropped support for SQL Server 2000. You'll either have to go back to VS2008/SL3, upgrade your SQL Server, or do things manually outside of Visual Studio.

...really appreciate this so much


Does it make any difference if you add this to the connection string ? Trusted_Connection=False;

A clue is that it's saying that it's not trusted which indicates it's not using the username and password from the string. Has a connection string been possibly imported into IIS ?

Trusted is windows authentication which by the error is being used. Sql server authentication is username and password which you are trying to use.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜