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

时间:2011-07-26 16:39:42

标签: wcf security

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

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

所有这些在Windows 2008 Server(和Windows 7 FWIW)上都很有效。但是,在Windows 2003 Server R2 SP 2上,此相同的配置失败。我启用了WCF跟踪并在服务端看到了此异常:

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

所以在Windows 2003上看起来,安全上下文没有通过。

我在MS支持中发现了一些类似的问题,但似乎大多数问题都围绕着IIS问题;此服务在Windows服务中自托管,不涉及IIS。

编辑:当Windows系统进程调用客户端时,发现这是一个问题 ONLY 。我可以以交互方式运行服务客户端(它只是一个控制台应用程序),它工作得很好。

有什么想法吗?

以下是主机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>

1 个答案:

答案 0 :(得分:0)

我认为你不能在windows 2003中托管net.tcp