简体   繁体   中英

ConnectionString for ObjectContext in MVC raised Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON' error

I'm working on an MVC application which uses ObjectContext (not DbContext) with EDMX file. As we know ObjectContext connection string is quite different from regular ADO.NET connection string. Here is the connection string I see in the application

<add name="AuthorEntities" connectionString="metadata=res://*/Models.AuthorEntities.csdl|res://*/Models.AuthorEntities.ssdl|res://*/Models.AuthorEntities.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ServerAddress;database=Author;user id=sa;password=Pass121212;Trusted_Connection=no;Integrated Security=True&quot;" providerName="System.Data.EntityClient" />

This connection string works locally very well but when I deploy the application on production machine. This displays an error:

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

I double checked all my credentials used here but nothing helps. I'm not using any kind of Impersonation settings in config file. By any chance if you faced/know this issue, please help.

user id=sa;password=Pass121212; ... Integrated Security=True

You are using integrated security (uses current Windows login for authentication) so the username and password here are ignored. You should either change this setting or ensure that your application is running as a user that can access the database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM