.net - WCF 服务连接问题 - 也许安全?

标签 .net wcf security

我正在尝试调试 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).

当我设置 security mode=none 并增加超时时,错误变为

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>

最佳答案

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

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

MSDN on WCF Tracing your application

A good tutorial to help you understand the MSDN

关于.net - WCF 服务连接问题 - 也许安全?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/600868/

相关文章:

windows - Windows 中关键容器存储文件的 GUID 后缀是什么?

c# - 对 MVC 站点具有特定要求的粒度权限

c# - 为什么PowerShell不能 'understand'响应文件的说明?

c# - 结构图 PerRequest 生命周期

c# - 构建队列服务 - 序列化任务供以后使用

wcf - 名称解析失败,Windows Azure

c# - 如何用MYSQL通过WCF Service插入操作?

angularjs - 无需用户身份验证(无凭据)的安全 REST API

java.security.NoSuchProviderException : no such provider: SunMSCAPI

c# - "~Method"是什么意思?