WCF服务方面的问题 - 也许安全性?安全性、方面、问题、WCF

2023-09-04 00:28:02 作者:低调的悲伤╮

我想调试WCF服务。此客户端已经能够在过去的连接,但是现在我无法连接。 该服务被部署到服务器。我打了服务器的服务页面,浏览器,我看到生成一个客户端的说明。 予使用SvcUtil工具重新生成的客户端代理和配置文件

客户端启动,但该服务的第一个调用返回1分钟后超时错误。同时,我可以连接到该服务运行在服务器上,并通过code步骤出现。我可以看到我的客户从来没有注册。在服务器$ C $下此调用断点不会被打。出于某种原因,我不能踏入服务器code(但我可以将调试器附加到服务的服务器上):

 无法自动步到服务器。
连接到服务器航天飞机的失败。
请安装Visual Studio的2008年远程调试器
服务器启用此功能。
 

远程调试安装并运行,或课程。 我是一个长期超时后收到此错误:

 客户端无法内完成安全协商中
配置的超时时间(00:00:00)。目前的谈判腿1(00:00:00)。
 

当我设置安全模式=没有,增加超时,错误修改

 开放的操作没有的00:02:00在规定的超时时间内完成。
分配给此操作的时间可能是的一部分
较长的超时时间。
 
如何面对边缘计算10个痛点

我没有运行任何防火墙,我看到了未来的要求在飘渺的服务器上。我期待在TCP流中,我不能说,为什么谈判失败。没有什么在事件日志相关。我正在失去动力,并会AP preciate提示。

客户端的app.config包含SvcUtil工具所产生的部分:

 < XML版本=1.0编码=UTF-8&GT?;
<结构>
    < system.serviceModel>
        <绑定>
            < wsDualHttpBinding>
                <绑定名称=WSDualHttpBinding_SportRadarDCS
                    closeTimeout =00:01:00openTimeout =00:01:00
                    receiveTimeout =00:10:00的SendTimeout =00:01:00
                    bypassProxyOnLocal =假transactionFlow =假
                    hostNameComparisonMode =StrongWildcard
                    maxBufferPoolSize =524288
                    maxReceivedMessageSize =65536
                    messageEncoding =文本textEncoding =UTF-8
                    useDefaultWebProxy =真正的>
                      < readerQuotas
                       MAXDEPTH =32maxStringContentLength =8192
                       maxArrayLength =16384
                       maxBytesPerRead =4096
                       maxNameTableCharCount =16384/>
                    <有序的ReliableSession =真
                       inactivityTimeout =00:10:00/>
                    <安全模式=消息>
                        <消息clientCredentialType =窗口
                           negotiateServiceCredential =真
                           algorithmSuite =默认/>
                    < /安全>
                < /装订>
            < / wsDualHttpBinding>
        < /绑定>
        <客户端>
            <端点
                 地址=...
                绑定=wsDualHttpBinding
                    bindingConfiguration =WSDualHttpBinding_SportRadarDCS
                    合同=SportRadarDCS
                    NAME =WSDualHttpBinding_SportRadarDCS>
                <身份>
                    <通过UserPrincipalName值=..我的域用户.../>
                < /身分>
            < /端点>
        < /客户>
    < /system.serviceModel>
< /结构>
 

解决方案

有一个在WCF跟踪。如果您的服务主机上运行此,它会给你这是存在的个别WCF通话,应该足够让你找出你的配置的一部分pooched。

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

MSDN上WCF跟踪您的应用程序

一个很好的教程,以帮助您了解在MSDN

I am trying to debug a WCF service. This client has been able to connect in the past, but now I cannot connect. The service is deployed to a server. I can hit the server's service page with the browser and I see the instructions for generating a client. I re-generated the client proxy and configuration file using svcutil.

The client starts up, but the first call to the service returns with an error after the 1 minute timeout. Meanwhile, I can attach to the service running on the server and step through the code there. I can see that my client was never registered. A breakpoint in the server code for this call does not get hit. For some reason, I cannot step into the server code (but I can attach the debugger to the service on the server):

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.

The remote debugger is installed and running, or course. I am getting this error after a long timeout:

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

When I set security mode=none, and increase the timeout, the error changes to

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.

I don't have any firewalls running and I see the request coming in on the server in Ethereal. I am looking at the TCP stream and I cannot say why the negotiation is failing. There is nothing related in the event log. I am running out of steam and would appreciate a hint.

The client app.config contains the section that svcutil generated:

<?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>

解决方案

Have a look at WCF Tracing. If you run this on your service host, it will give you individual WCF calls which are occuring, and should be enough for you to find out what part of your configuration is pooched.

I found specifically with connection issues that this was the only way to troubleshoot the reasons.

MSDN on WCF Tracing your application

A good tutorial to help you understand the MSDN