1

服务器没有提供有意义的回复,这可能是由于合同错误、会话过早关闭或内部服务器错误造成的

嘿,调用 wcf 服务后出现异常。我知道这个异常可以在 stackoverflow 上找到很多,但我有一个特殊的行为。我也尝试了几乎所有推荐的解决方案,但没有成功......

我的项目执行以下操作:该模块就像一个普通的聊天,一个 wpf 和 asp 用户控件每 5 秒调用一次服务并获取在线用户。这通常在我的 Windows 7 工作站上运行良好。在我开始在装有 win 8 的新工作站上开发软件后,我遇到了这个异常。IIS 配置仍然相同。在第一个用户开始频繁调用该服务后,一切正常,直到第二个用户调用相同的服务,上述异常出现。我在win 7上设置了一个测试机,看看会发生什么......一切都恢复正常了......我不知道该怎么做......

服务 web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<sources>
  <source name="System.ServiceModel" switchName="Information, ActivityTracing"     propagateActivity="true">
    <listeners>
      <add name="xml" />
    </listeners>
  </source>
  <source name="System.ServiceModel.MessageLogging">
    <listeners>
      <add name="xml" />
    </listeners>
  </source>
  <source name="myUserTraceSource" switchName="Information, ActivityTracing">
    <listeners>
      <add name="xml" />
    </listeners>
  </source>
</sources>
<sharedListeners>
  <add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="hi5.PSA.ServiceLog.svclog" />
</sharedListeners>
</system.diagnostics>
<appSettings>
<add key="Log4NetPath" value="config.log4net" />
</appSettings>
<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>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
<!-- that many MB should be enough :) -->
<httpRuntime maxRequestLength="2147483647" />
</system.web>
<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IPmiLookup" />
  </basicHttpBinding>
</bindings>
<services>
  <service name="SolutionName.ChatService" behaviorConfiguration="chatServiceBehavior">
    <endpoint address="" binding="wsDualHttpBinding" contract="SolutionName.contracts.Chat.IChatManager" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>        
    <behavior name="chatServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
  <modules runAllManagedModulesForAllRequests="true"></modules>
 </system.webServer>
<connectionStrings>
<add name="MyEntities" connectionString="metadata=res://*/Users.csdl|res://*/Users.ssdl|res://*/Users.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=localhost;Initial Catalog=MyDB;Integrated Security=SSPI;MultipleActiveResultSets=True&quot;&#xD;&#xA;" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>

客户端 app.config:

<system.serviceModel>
<bindings>
  <wsDualHttpBinding>
    <binding name="WSDualHttpBinding_IChatManager" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" />
      <security mode="Message">
        <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" />
      </security>
    </binding>
  </wsDualHttpBinding>
</bindings>
<client>
  <endpoint address="http://localhost/SolutionName/ChatService.svc" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IChatManager" contract="hi5.medview.server.contracts.Chat.IChatManager" name="WSDualHttpBinding_ChatManager">
    <identity>
      <servicePrincipalName value="host/MyName"/>
    </identity>
  </endpoint>
</client>

有没有人有任何想法。让我抓狂的是,该服务对于第一个调用它的用户来说工作正常,但是在第二个用户调用它之后,该死的东西不再工作了......请帮助......谢谢

4

0 回答 0