I am writing a service that allows users to register on it and receive notifications when an event occurs. I try to do this with netTcpBinding, but keep coming up with errors even when working on the local machine.
When I try to send a notification, I disconnected, getting this error:
Stream security requires http://www.w3.org/2005/08/addressing/anonymous , but the security context has not been discussed. This is likely due to the fact that the remote endpoint does not miss the StreamSecurityBindingElement from the binding.
For testing, I place the service in the console, and it opens for me, and I can see the WSDL and run svcutil. When I start the client and try to send a notification, an error message appears.
Host App.config:
<system.serviceModel> <services> <service name="CompanyName.WebServices.InterventionService.RegistrationService" behaviorConfiguration="RegistrationServiceBehavior"> <endpoint address="http://localhost:8000/CompanyName/Registration" binding="wsDualHttpBinding" contract="CompanyName.WebServices.InterventionService.Interfaces.IRegistrationService"/> <endpoint address="net.tcp://localhost:8001/CompanyName/Registration" binding="netTcpBinding" contract="CompanyName.WebServices.InterventionService.Interfaces.IRegistrationService"/> </service> <service name="CompanyName.WebServices.InterventionService.NotificationService" behaviorConfiguration="NotificationServiceBehavior"> <endpoint address="http://localhost:8010/CompanyName/Notification" binding="wsDualHttpBinding" contract="CompanyName.WebServices.InterventionService.Interfaces.INotificationService"/> <endpoint address="net.tcp://localhost:8011/CompanyName/Notification" binding="netTcpBinding" contract="CompanyName.WebServices.InterventionService.Interfaces.INotificationService"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="RegistrationServiceBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8000/CompanyName/Registration"/> </behavior> <behavior name="NotificationServiceBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8010/CompanyName/Notification"/> </behavior> <behavior name="netTcpRegistrationServiceBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="net.tcp://localhost:8001/CompanyName/Registration"/> </behavior> <behavior name="netTcpNotificationServiceBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="net.tcp://localhost:8011/CompanyName/Notification"/> </behavior> </serviceBehaviors> </behaviors>
Here is the App.config client:
<system.serviceModel> <bindings> <netTcpBinding> <binding name="NetTcpBinding_IRegistrationService"> <security mode="None"> <message clientCredentialType="None"/> <transport clientCredentialType="None"/> </security> </binding> <binding name="NetTcpBinding_INotificationService"> <security mode="None"> <message clientCredentialType="None"/> <transport clientCredentialType="None"/> </security> </binding> </netTcpBinding> <wsDualHttpBinding> <binding name="WSDualHttpBinding_IRegistrationService"> <reliableSession ordered="true"/> <security mode="None"> <message clientCredentialType="None" negotiateServiceCredential="false"/> </security> </binding> <binding name="WSDualHttpBinding_INotificationService"> <reliableSession ordered="true"/> <security mode="None"> <message clientCredentialType="None" negotiateServiceCredential="false"/> </security> </binding> </wsDualHttpBinding> </bindings> <client> <endpoint address="http://localhost:8000/GPS/Registration" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IRegistrationService" contract="IRegistrationService" name="WSDualHttpBinding_IRegistrationService"> </endpoint> <endpoint address="net.tcp://localhost:8001/GPS/Registration" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IRegistrationService" contract="IRegistrationService" name="NetTcpBinding_IRegistrationService"> </endpoint> <endpoint address="http://localhost:8010/GPS/Notification" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_INotificationService" contract="INotificationService" name="WSDualHttpBinding_INotificationService"> </endpoint> <endpoint address="net.tcp://localhost:8011/GPS/Notification" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_INotificationService" contract="INotificationService" name="NetTcpBinding_INotificationService"> </endpoint> </client>
I missed a lot of registration code, since I'm only trying to get a notification that works right now.
It is planned to place this in a Windows service in 2003 on a server that is not part of the clientโs domain (setting them up), and client computers will be in the clientโs domain.
Edit:
I added bindings to the App.config host:
<bindings> <netTcpBinding> <binding name="NetTcpBinding_IRegistrationService"> <security mode="None"> <message clientCredentialType="None"/> <transport clientCredentialType="None"/> </security> </binding> <binding name="NetTcpBinding_INotificationService"> <security mode="None"> <message clientCredentialType="None"/> <transport clientCredentialType="None"/> </security> </binding> </netTcpBinding> <wsDualHttpBinding> <binding name="WSDualHttpBinding_IRegistrationService"> <reliableSession ordered="true"/> <security mode="None"> <message clientCredentialType="None" negotiateServiceCredential="false"/> </security> </binding> <binding name="WSDualHttpBinding_INotificationService"> <reliableSession ordered="true"/> <security mode="None"> <message clientCredentialType="None" negotiateServiceCredential="false"/> </security> </binding> </wsDualHttpBinding> </bindings>
These are still errors, and the Steam Security error message is required. Trying a small subset of this application in a new solution.