从Windows Form Timing Out引用的WCF

时间:2016-07-13 11:19:43

标签: c# wcf

我有一个引用WCF服务的Windows窗体。一切都工作正常,但有时我得到一个错误,说明已经发生了超时。我试图搜索解决方案,但这个想法不是那么清楚所以任何帮助将不胜感激。

在windows中形成app.config文件我以这种方式添加了绑定:

<basicHttpBinding>
        <binding name="myBasicBinding" closeTimeout="00:51:00" openTimeout="00:51:00"
          receiveTimeout="00:30:00" sendTimeout="00:51:00" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
          transferMode="Streamed">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
        <binding name="BasicHttpBinding_IService1" />
      </basicHttpBinding>


<client>
 <endpoint address="wcf URL"
        binding="basicHttpBinding" bindingConfiguration="myBasicBinding"
        contract="ServiceNew.IService1" name="BasicHttpBinding_IService1" />
    </client>
在WCF Web配置中

我应该添加有关超时的任何内容吗?

另外,我发送大量字节,所以我关心超时和发送数据的大小。但请注意,超时有时会在通话几秒后发生。

1 个答案:

答案 0 :(得分:0)

这可能有很多原因。例如,可能是您的Windows事件日志已满。我在安全协议和握手未能完成的环境中经历过这种情况。您应该启用诊断跟踪,例如:

def home(request):
    if request.path == '/en/':
        return render(request, 'app/home_en.html', {'title':'HOME'})
    else:
        return render(request, 'app/home_es.html', {'title':'HOME'})

def about(request):
        if request.path == '/en/about':
            return render(request, 'app/about_en.html', {'title':'ABOUT'})
        else:
            return render(request, 'app/about_es.html', {'title':'ABOUT'})

请查看以下链接,例如http://www.andyfrench.info/2010/11/wcf-service-throwing-immediate-timeout.html