如何解决 WCF CommunicationException 未处理
我有一些问题。
问题是 CommunicationException
错误。
错误消息是
接收时发生错误 HTTP 响应 http://localhost:18080/WCFServices/TestService。 这可能是由于服务 端点绑定不使用 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 已修改,暂时
请任何人使用。
谢谢。
哦,抱歉,“电压”发生错误
我尝试增加最大尺寸和长度。
但是,它并没有解决这个问题。
有人帮助我。
I have some problems.
the issue is CommunicationException
error.
error message is
An error occurred while receiving the
HTTP response to
http://localhost:18080/WCFServices/TestService.
This could be due to the service
endpoint binding not using the HTTP
protocol. This could also be due to an
HTTP request context being aborted by
the server (possibly due to the
service shutting down). See server
logs for more details.
I wrote below source code.
TestServiceClient client = new TestServiceClient();
TestSettings[] voltages = client.GetTestSettings();
Error message appears above tilt word.
I want to synchronize Main Application and Client Application.
Above error is Client Application.
My app.config file is
<?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 is modified that is temporarily
please anyone.
thanks.
oh sorry, error occurred on "voltage"
I tried to increase maxsize and length.
but, it didn`t resolve this issue.
somebody help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果看不到服务器端配置,就很难帮助您排除故障。
话虽如此,为了获得真正的底层异常(您看不到真正发生的情况),您可以做的一件事是 配置 WCF 跟踪。只需将该配置片段放入服务器端的配置文件中,然后查看生成的日志即可。这应该会指出真正的问题。完成后请务必将其取出。
Without seeing your server side config it's going to be hard to help you troubleshoot.
Having said that, one of the things you can do to get the real underlying exception (you're not seeing what's really going on) is to configure WCF Tracing. Just drop that config snippet in the config file on your server side, and look through the logs generated. That should point you to the real problem. Make sure to take it back out when you're finished.