gpt4 book ai didi

c# - 类型为“System.Data.SqlClient.SqlException”的未处理异常

转载 作者:太空宇宙 更新时间:2023-11-03 23:02:13 25 4
gpt4 key购买 nike

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

我不断收到回复 -

An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in 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>

数据应用程序配置

    <?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>

最佳答案

在您的 connectionString 中添加 Connect Timeout=90

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

关于c# - 类型为“System.Data.SqlClient.SqlException”的未处理异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42690066/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com