Security Exception in WCF service on Windows 2003 Server
I am having a problem hosting a simple WCF service in Windows 2003 Server. I am using the netTcpBinding and, by default, it is using Windows authentication.
The client is running on another server, and is called by a windows system process to pass some simple information back to the service. The security context should be be passed through back to the service, and the client Identity should be NT AUTHORITY\SYSTEM.
All this works just grand on Windows 2008 Server (and windows 7 FWIW). However, this same configuration fails on Windows 2003 Server R2, SP 2. I turned in WCF tracing and saw this exception on the service side:
SecurityTokenValidationException: The service does not allow you to log on anonymously
So it looks like on Windows 2003, the security context is not being passed through.
I have found some similar issues talked about in SO and this from MS Support, but it seems most of them revolve around IIS issues; this service is self-hosted in a windows service, no IIS involved.
EDIT: Just found out that this is a problem ONLY when the client is called by the windows system process. I can run the service client interactively (it is just a console application) and it works just fine.
Any ideas?
Here is the host WCF configuration:
<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>
and here is the client config:
<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"
bind开发者_StackOverflow社区ingConfiguration="NetTcpBinding_IMyService"
contract="IMyService"
name="NetTcpBinding_IMyService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
</client>
I don't think you can host net.tcp in windows 2003
精彩评论