我明天有一项作业要交,我正在慢慢失去理智。一些帮助,将不胜感激。

我不断得到回应-


  类型为'System.Data.SqlClient.SqlException'的未处理异常
  发生在EntityFramework.SqlServer.dll中


附加信息:执行超时已过期。在操作完成之前超时或服务器没有响应。

附加信息:在模型生成期间检测到一个或多个验证错误:

以下是我的两个app.configs

控制台应用程序配置

<?xml version="1.0" encoding="utf-8"?>
  <configuration>
    <configSections>
      <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    </configSections>
          <startup>

  <connectionStrings>

    <add
    name="VoteWithDEV"
    connectionString="Data Source=k2mmbsouh0.database.windows.net;
    Initial Catalog=VoteWithDEV;Persist Security Info=True;User ID=patrickmcmu11an;;Password=Jordan123"
    providerName="System.Data.SqlClient"/>
    </connectionStrings>

    <appSettings>
     <add key="ConnectionStringName" value="VoteWithDEV"/>
    </appSettings>


</startup>




数据APP.Config

    <?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
    <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.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb"/>
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
    <connectionStrings>
    <add
   name="VoteWithDEV"
   connectionString="Data Source=k2mmbsouh0.database.windows.net;
        Initial Catalog=VoteWithDEV;Persist Security Info=True;User ID=username;Password=password"
   providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <appSettings>
      <add key="ConnectionStringName" value="VoteWithDEV"/>
    </appSettings>
    </configuration>

最佳答案

Connect Timeout=90中添加connectionString

connectionString="Data Source=k2mmbsouh0.database.windows.net;
        Initial Catalog=VoteWithDEV;Persist Security Info=True;User ID=username;Password=password;Connect Timeout=90 "

10-04 14:52