entity-framework - Entity Framework 和连接字符串

标签 entity-framework connection-string

我正在尝试将我的 .net 网站部署到共享托管服务器。当 Entity Framework 尝试连接到数据库时,出现以下错误:

Server Error in '/' Application.

Login failed for user 'PHX3\Iusr_9086819'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'PHX3\Iusr_9086819'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Login failed for user 'PHX3\Iusr_9086819'.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5061898
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234

这是我的连接字符串,已删除敏感数据:

<add name="CoreEntities" 
         connectionString="
            metadata=res://*/CoreModel.csdl|res://*/CoreModel.ssdl|res://*/CoreModel.msl;
            provider=System.Data.SqlClient;
            provider connection string='
                Data Source=*****.db.*****.hostedresource.com; 
                Initial Catalog=kshoultz;       
                integrated security=True;
                multipleactiveresultsets=True;
                App=EntityFramework; 
                User ID=*****;
                Password=*****; 
                Database=*****;
         '" 
         providerName="System.Data.EntityClient" />

最佳答案

我认为集成安全性应该是 false - 这意味着不使用用户 ID 和密码。初始目录是数据库的名称 - 他们是否告诉您数据库名为 kshoultz? (可能是,我不知道有什么不同,但如果您创建了一个数据库并选择了一个名称,那就是您想要使用的名称)。密码中是否包含非字母/数字的字符?你必须对它们进行编码,例如你的密码是Love&Peace,你必须说Love&Peace

您是否寻求过 GoDaddy 支持?

关于entity-framework - Entity Framework 和连接字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9695023/

相关文章:

c# - 获取继承自 Asp.Net MVC 中的 ApplicationUser 的自定义用户类列表

mysql - EF6 与 MySQL。字典中不存在给定的键

c# - 我可以访问 Entity Framework 中 IDbCommandInterceptor 中的实体吗

.net - 在运行时将 ADO.Net DataSet 指向不同的数据库?

sql-server - SQL SERVER ODBC 错误(对象名称无效),但是当我添加 SQL 查询 mydb.dbo.mytable 时一切正常

database - 没有任何connectionString自动创建localdb?

c# - 如何在 Entity Framework Code First 中加密数据?

c# - 从 LINQ to SQL 升级到 EF 4.1 时如何最大限度地减少性能损失?

mysql - 在 ms-access 中与 mysql 服务器的无 DSN 连接不记得用户名和密码

asp.net - 从 ASP.NET 应用程序更改 web.config