底层连接已关闭:连接意外关闭。 这发生在托管在开发服务器中构建的Visual Studio 2010的我的WCF服务上。
信息:
这种情况不会发生,我相信这是一个“大数据”的问题所有的时间,我用Google搜索硬如我可以,但我已经实现了固定的任何解决方案的非(和我已经尝试了其中的大部分)我最有可能只是失去了一些愚蠢的东西。
问:
这究竟是为什么以及如何解决呢?
客户端的app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Program.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" maxReceivedMessageSize="20000000"
maxBufferSize="20000000"
maxBufferPoolSize="20000000">
<readerQuotas maxDepth="32"
maxArrayLength="200000000"
maxStringContentLength="200000000"/>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:62753/Service1.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="ProgramService.IService1"
name="BasicHttpBinding_IService1" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="EndpointBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
<applicationSettings>
<Program.Properties.Settings>
<setting name="Program_PROGRAM_Screen" serializeAs="String">
<value>http://localhost/IntegrationTest/SOAP/PROGRAM.asmx</value>
</setting>
</Program.Properties.Settings>
</applicationSettings>
</configuration>
服务的web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<httpRuntime executionTimeout="1200" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<connectionStrings>
<add name="ProgramEntities" connectionString="metadata=res://*/Program.csdl|res://*/Program.ssdl|res://*/Program.msl;provider=System.Data.SqlClient;provider connection string="data source=ACUMATICA1-HPI7;initial catalog=Program;persist security info=True;user id=sa;password=$0l0m0n;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
WCF活动日志埃罗消息:
而试图序列参数 时出错http://tempuri.org/:ScenarioSummaryResult。该消息的InnerException是 “类型 ‘System.Data.Entity.DynamicProxies.ScenarioSummary_A170028D0330F7804BAB85D00BA1EB45FA1754C8A6F6E98C0F003F15078E23A9’ 数据合同名称 ‘ScenarioSummary_A170028D0330F7804BAB85D00BA1EB45FA1754C8A6F6E98C0F003F15078E23A9:http://schemas.datacontract.org/2004/07/System.Data.Entity.DynamicProxies’ 预计不会。考虑使用DataContractResolver或将任何未知的 类型静态添加到已知类型的列表中 - 例如,使用KnownTypeAttribute属性的 或将其添加到传递给DataContractSerializer的已知类型的 列表中。有关更多详细信息,请参阅 InnerException。
服务信息:
我试图返回的实体框架的完整清单
//IService1.cs
[OperationContract]
List<ProgramService.ScenarioSummary> ScenarioSummary(string Module);
//Service1.svc
public List<ProgramService.ScenarioSummary> ScenarioSummary(string module)
{
return (from p in Entity.ScenarioSummaries where p.ModuleId.Equals(Entity.Modules.FirstOrDefault(q => q.ModuleName.Equals(module)).Id) select p).ToList();
}
附加信息:
在这件事上我清楚无能的任何帮助/解释,如何纠正它将不胜感激。
您是否尝试过增加绑定conf中的超时时间?像' ...'。只是为了确保,不是这种超时是问题的原因。 –
Desty
启用跟踪http://stackoverflow.com/questions/4271517/how-to-turn-on-wcf-tracing并检查那里。 –
“我尽可能地用Google搜索了”-jvanh1-post:底层连接已关闭 问题行:7 –