1

问题:

基础连接已关闭:连接意外关闭。这发生在我的 WCF 服务上,该服务托管在 Visual Studio 2010 内置开发服务器上。

信息:

这不会一直发生我认为这是一个“大数据”问题,我已经尽我所能用谷歌搜索,但我实施的解决方案都没有解决任何问题(我已经尝试了其中的大部分)我最可能只是错过了一些愚蠢的东西。

问题:

为什么会发生这种情况,我该如何解决?

客户端应用程序配置:

<?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=&quot;data source=ACUMATICA1-HPI7;initial catalog=Program;persist security info=True;user id=sa;password=$0l0m0n;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

WCF 活动日志错误消息:

尝试序列化参数 http://tempuri.org/:ScenarioSummaryResult时出错。The InnerException message was 'Type 'System.Data.Entity.DynamicProxies.ScenarioSummary_A170028D0330F7804BAB85D00BA1EB45FA1754C8A6F6E98C0F003F15078E23A9' with data contract name 'ScenarioSummary_A170028D0330F7804BAB85D00BA1EB45FA1754C8A6F6E98C0F003F15078E23A9: http://schemas.datacontract.org/2004/07/System.Data.Entity.DynamicProxies ' is not expected. 考虑使用 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();
        }

附加信息:

对于我在这件事上明显无能以及如何纠正它的任何帮助/解释将不胜感激。

4

1 回答 1

1

有人评论说我的错误看起来很像What are the downsides to turn off ProxyCreationEnabled for CTP5 of EF code first

这实际上是我的解决方案。他们已经删除了他们的帖子。谢谢你比我更擅长谷歌搜索的神秘陌生人。

于 2013-01-23T19:57:32.093 回答