【问题标题】:WCF service connection issue - maybe security?WCF 服务连接问题 - 也许是安全性?
【发布时间】:2010-10-10 16:40:35
【问题描述】:

我正在尝试调试 WCF 服务。该客户端过去可以连接,但现在无法连接。 该服务部署到服务器。我可以用浏览器访问服务器的服务页面,我会看到生成客户端的说明。 我使用 svcutil 重新生成了客户端代理和配置文件。

客户端启动,但对服务的第一次调用在 1 分钟超时后返回错误。同时,我可以附加到服务器上运行的服务并单步执行那里的代码。我可以看到我的客户从未注册过。此调用的服务器代码中的断点不会被命中。由于某种原因,我无法进入服务器代码(但我可以将调试器附加到服务器上的服务):

Unable to automatically step into the server. 
Connecting to the server machine 'shuttle' failed. 
Please install the Visual Studio 2008 Remote Debugger on the 
server to enable this functionality.

远程调试器已安装并正在运行,或者当然。 长时间超时后我收到此错误:

Client is unable to finish the security negotiation within the 
configured timeout (00:00:00).  The current negotiation leg is 1 (00:00:00).

当我设置安全模式=无,并增加超时,错误变为

The open operation did not complete within the allotted timeout of 00:02:00.
The time allotted to this operation may have been a portion of a 
longer timeout.

我没有运行任何防火墙,我在 Ethereal 的服务器上看到了请求。我正在查看 TCP 流,但我无法说出协商失败的原因。事件日志中没有任何相关内容。我已经筋疲力尽了,希望能得到提示。

客户端 app.config 包含 svcutil 生成的部分:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <wsDualHttpBinding>
                <binding name="WSDualHttpBinding_SportRadarDCS" 
                    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="...."
                binding="wsDualHttpBinding" 
                    bindingConfiguration="WSDualHttpBinding_SportRadarDCS"
                    contract="SportRadarDCS" 
                    name="WSDualHttpBinding_SportRadarDCS">
                <identity>
                    <userPrincipalName value=".. my domain user ..." />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

【问题讨论】:

    标签: .net wcf security


    【解决方案1】:

    查看 WCF 跟踪。如果您在服务主机上运行它,它将为您提供正在发生的单独 WCF 调用,并且应该足以让您找出配置的哪一部分被占用了。

    我特别发现这是解决连接问题的唯一方法。

    MSDN on WCF Tracing your application

    A good tutorial to help you understand the MSDN

    【讨论】:

    • 谢谢,很有帮助。我发现的错误是:没有通道可以接受带有操作“schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence”的消息。我会从这里拿走。
    • 事实证明这是一个 DNS 问题。由于某种原因,我的工作站不在 DNS 中,并且在服务器上查找回调端点失败。一旦我解决了这个问题,它就起作用了。
    • 为证明这一点而欢呼,通过 WCF 跟踪解决连接问题。很高兴您解决了问题。
    猜你喜欢
    • 1970-01-01
    • 2016-11-12
    • 2012-02-13
    • 1970-01-01
    • 1970-01-01
    • 2010-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多