如何解决WCF CommunicationException未处理

问题描述:

我有一些问题。如何解决WCF CommunicationException未处理

问题是CommunicationException错误。

错误消息是

在接收到 http://localhost:18080/WCFServices/TestService的 HTTP响应时发生错误。 这可能是由于服务 端点绑定未使用HTTP 协议。这也可能是由于 HTTP请求上下文被服务器的 中止(可能由于 服务关闭)。有关更多详细信息,请参阅服务器 日志。

我在下面写的源代码。

TestServiceClient client = new TestServiceClient(); 
TestSettings[] voltages = client.GetTestSettings(); 

错误信息出现在倾斜词上方。

我想同步主应用程序和客户端应用程序。

以上错误是客户端应用程序。

我app.config文件是

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="WSHttpBinding_ITestService" 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="209715200" 
      messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
      allowCookies="false"> 
      <readerQuotas maxDepth="32" maxStringContentLength="2147483647" 
      maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="16384" /> 
      <reliableSession ordered="true" inactivityTimeout="00:10:00" 
      enabled="false" /> 
      <security mode="None"> 
      <transport clientCredentialType="Windows" proxyCredentialType="None" 
       realm="" /> 
      <message clientCredentialType="Windows" negotiateServiceCredential="true" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://localhost:18080/WCFServices/TestService" 
     binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ITestService" 
     contract="TestServiceReference.ITestService" 
     name="WSHttpBinding_ITestService" /> 
    </client> 
    </system.serviceModel> 
</configuration> 

PS。 TestService被修改临时

请任何人。

谢谢。

噢,对不起,在

我试图增加MAXSIZE和长度“电压”发生错误。

但是,它并没有解决这个问题。

有人帮助我。

+1

请向我们展示您的服务器配置文件。 – flayn 2011-04-11 12:40:52

+0

如果您发布代码,XML或数据样本,请**在文本编辑器中突出显示这些行,然后单击编辑器工具栏上的“代码样本”按钮(“{}”)以精确地格式化和语法突出显示它!如果您发布错误消息,**请**使用blockquotes('“')正确格式化错误消息。 – 2011-04-11 13:07:56

没有看到您的服务器端配置,它将很难帮助您排除故障。

话虽如此,你可以做的事情之一,以获得真正的底层异常(你没有看到真正发生的事情)是configure WCF Tracing。只需将该配置代码片段放在服务器端的配置文件中,然后查看生成的日志。这应该指出你真正的问题。确保在完成后将其取出。

+0

哦,对不起,在”电压“上发生错误。 – 2011-04-11 23:11:16