我在项目中关注了图层:
我写了这段代码
public IList<Tools> getAllTools()
{
using (LifeExpressContext lifeExpressContext = new LifeExpressContext())
{
var tools = lifeExpressContext.tools.ToList();
return tools;
}
}
从我的服务层调用此方法,该服务层从Web层调用。
我在每一层都添加了对EntityFramework.dll
和EntityFramework.SqlServer.dll
的引用。
但是当我尝试从数据库中获取记录时,它给了我错误
类型&#39; System.TimeoutException&#39;的例外情况发生在mscorlib.dll但未在用户代码中处理 附加信息:请求信道在00:00:59.9489971之后等待回复时超时。增加传递给Request的调用的超时值或增加Binding上的SendTimeout值。分配的时间
这是我在Business层上的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.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add name="LifeExpressContext" connectionString="Data Source=AMIT-PC;Initial Catalog=LifeExpressApp;User ID=sa;Password=12345" providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
这是我的WCF图层的配置文件代码
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>