Windows 2003服务器上WCF服务中的安全异常

Windows 2003服务器上WCF服务中的安全异常,wcf,security,Wcf,Security,我在Windows 2003 Server中托管简单WCF服务时遇到问题。我使用的是netTcpBinding,默认情况下,它使用的是Windows身份验证 客户端正在另一台服务器上运行,由windows系统进程调用,以将一些简单信息传递回服务。安全上下文应传递回服务,客户端标识应为NT AUTHORITY\SYSTEM 所有这些都可以在Windows2008Server(和Windows7FWIW)上运行。但是,同样的配置在Windows 2003服务器R2 SP 2上失败。我打开了WCF跟踪

我在Windows 2003 Server中托管简单WCF服务时遇到问题。我使用的是netTcpBinding,默认情况下,它使用的是Windows身份验证

客户端正在另一台服务器上运行,由windows系统进程调用,以将一些简单信息传递回服务。安全上下文应传递回服务,客户端标识应为NT AUTHORITY\SYSTEM

所有这些都可以在Windows2008Server(和Windows7FWIW)上运行。但是,同样的配置在Windows 2003服务器R2 SP 2上失败。我打开了WCF跟踪,在服务端看到了这个异常:

SecurityTokenValidationException:该服务不允许您匿名登录

因此,在Windows 2003上,似乎没有传递安全上下文

我在微软支持部的《某某》和《此书》中发现了一些类似的问题,但似乎大部分都是围绕IIS问题展开的;此服务在windows服务中自托管,不涉及IIS

编辑:刚刚发现,只有当windows系统进程调用客户端时,这才是一个问题。我可以以交互方式运行服务客户端(它只是一个控制台应用程序),并且工作正常

有什么想法吗

以下是主机WCF配置:

<service name="MyService">
    <endpoint 
        address="" 
        binding="netTcpBinding" 
        bindingConfiguration="" 
        contract="IMyService">
        <identity>
            <dns value="localhost" />
        </identity>
    </endpoint>
    <host>
        <baseAddresses>
            <add baseAddress="net.tcp://TheAppServer:8732/MyService/" />
        </baseAddresses>
    </host>
</service>

以下是客户端配置:

<system.serviceModel>
<bindings>
    <netTcpBinding>
        <binding 
            name="NetTcpBinding_IMyService" 
            transactionFlow="false" 
            transferMode="Buffered" 
            transactionProtocol="OleTransactions" 
            hostNameComparisonMode="StrongWildcard">
            <reliableSession 
                ordered="true" 
                inactivityTimeout="00:10:00" 
                enabled="false"/>
            <security mode="Transport">
                <transport 
                    clientCredentialType="Windows" 
                    protectionLevel="EncryptAndSign"/>
                <message 
                    clientCredentialType="Windows"/>
            </security>
        </binding>
    </netTcpBinding>
</bindings>
<client>
    <endpoint 
        address="net.tcp://TheAppServer:8732/MyService/" 
        binding="netTcpBinding" 
        bindingConfiguration="NetTcpBinding_IMyService" 
        contract="IMyService" 
        name="NetTcpBinding_IMyService">
        <identity>
            <dns value="localhost"/>
        </identity>
    </endpoint>
</client>


我认为您无法在windows 2003中托管net.tcp

我认为您需要在服务器端重新创建相同的绑定配置,并确保服务器端的端点使用该绑定配置(具有传输安全性),您可以在服务器端创建相同的绑定,并且根据您列出的异常,我认为客户端没有将凭据发送到服务器端,你能检查一下吗?只是添加了一个重要的编辑:如果我从桌面以交互方式执行客户端,此配置工作正常