[英]An unhandled exception of type 'System.Data.SqlClient.SqlException
I have an assignment due tomorrow and I am slowly losing my mind. 我明天有一份作业,我慢慢失去理智。 Some help would be appreciated. 一些帮助将不胜感激。
I keep getting the response - 我一直得到回应 -
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in EntityFramework.SqlServer.dll EntityFramework.SqlServer.dll中出现未处理的“System.Data.SqlClient.SqlException”类型异常
Additional information: Execution Timeout Expired. 附加信息:执行超时已过期。 The timeout period elapsed prior to completion of the operation or the server is not responding. 操作完成之前经过的超时时间或服务器没有响应。
Additional information: One or more validation errors were detected during model generation: 附加信息:在模型生成期间检测到一个或多个验证错误:
Below is both my app.configs 下面是我的app.configs
CONSOLE APP.CONFIG CONSOLE 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>
<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>
DATA APP.Config DATA 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>
Add Connect Timeout=90
in your connectionString
. 在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 "
Try SQL Management Studio to check if you can connect. 尝试使用SQL Management Studio检查是否可以连接。 I suspect that the server is down/unreachable. 我怀疑服务器已关闭/无法访问。
i faced with this error when SQL server is unreachable. 当SQL服务器无法访问时,我遇到此错误。 for checking : 检查:
Win + R -> services.msc -> find out Sql Server [instance name] -> right click on it and click Start. Win + R - > services.msc - >找出Sql Server [实例名称] - >右键单击它并单击开始。
if that not works using SQL server repair solution : https://docs.microsoft.com/en-us/sql/database-engine/install-windows/repair-a-failed-sql-server-installation?view=sql-server-2017 如果使用SQL Server修复解决方案不起作用: https : //docs.microsoft.com/en-us/sql/database-engine/install-windows/repair-a-failed-sql-server-installation?view = sql-服务器-2017
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.