【问题标题】:EF Code First Connecting to SQL Server 2008 R2EF Code First 连接到 SQL Server 2008 R2
【发布时间】:2014-05-21 20:04:21
【问题描述】:

我正在努力寻找一个解决方案来解决我连接到在我的家庭网络上运行的 SQL Server 的问题。它通常工作正常,我有其他使用 EF 的项目在我使用 EDMX 模型的地方正常工作。即时传递的 SQL 身份验证详细信息可以正常连接到服务器。

我在我的 App.Config 文件中使用以下连接字符串:-

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
  <connectionStrings>
    <add name="Entities"
         providerName="System.Data.SqlClient"
         connectionString="Server=192.168.1.4\SQLDEV01;Database=TestLab;user id=Kaiser;password=mud.sit.map-651;Integrated Security=True;" />
  </connectionStrings>
</configuration>

抛出的异常是:-

{"提供者没有返回 ProviderManifestToken 字符串。"}

及其内部异常>

登录失败。登录来自不受信任的域,无法使用 使用 Windows 身份验证。

【问题讨论】:

    标签: c# sql-server entity-framework ef-code-first


    【解决方案1】:

    当您指定 Trusted_Connection=true 时,您正在使用 Windows 身份验证,因此它会尝试使用附加到您正在运行的任何类型应用程序的线程的身份登录。

    如果您使用 sql 身份验证,请从连接字符串中删除 Trusted_Connection 属性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多