|
|
 Prize winner in Competition
"Best ASP.NET article of July 2008"
Comments and Discussions
|
|
 |

|
Nice article. You have solved my problem for which i was struggling to find an answer for almost a week.
|
|
|
|

|
It appears that if you dont export the server certificate onto the client machine, the connection will still work, as long as you have the CA certificate, correct?
|
|
|
|

|
Great article. I love it.
Export/import public key manually is not fun for sure. Since NegotiateServiceCredential is set default to true. I don't think we need export/import public key manually.
By the way, I don't have environment to test and confirm it. Hope somebody can try it and post a feedback.
Thanks a lot.
www
|
|
|
|

|
Awesome and very impressive presentation
|
|
|
|
|

|
Really thanks for this great article
|
|
|
|

|
Could you guide us as to how this secure service would be called with non.NET clients?
|
|
|
|
|

|
This is an amazing walk through and after days of toiling it helped me out tremendously. One place I got caught up was with the error "Key Set Does Not Exist", even after setting the appropriate permissions for IIS to read the private key. This issue occurs from dragging certificates from one store to another in the MMC certificate snap in.
When I created the keys from my CA they were automatically installed under the "Current User" certificate store and then I dragged them to the "Local Computer" store where they needed to be. Even though this is possible, the key will not work correctly.
If you are getting the "Key Set Does Not Exist" error you need to export the public and private key from the "Current User" store and then import it again in the correct location.
|
|
|
|
|

|
Great article. Many many thanks.
|
|
|
|

|
Thanks for posting this article .
fdgh fdhgdfhwwsrt etetr erte tete tertet ertet erte ertetet
|
|
|
|
|

|
So is there any way to embed the certificates into the assembly or load from a file?
Thanks,
Jeff
|
|
|
|

|
Great Job, Appreciated.
How we can deploy in a IIS?
I hope the example works on local host.
S.V.Rajkumar
|
|
|
|

|
Thanks a lot, you just save a great amount of searching time over the web. Great stuff, well documented. Good work !
War does not make one great.
---------
Master Yoda
|
|
|
|

|
HI,
Please help me out for creating Certificate concept in 2008 server...
Same steps mentioned in the current article
Thanks In Advance,
Regards,
Rajesh.
|
|
|
|

|
Thanks for such a detailed article on securing WCF services!
|
|
|
|

|
Hi,
Thanks for your time. It really helped me to understand and configure X509 certificate for my WCF service.
Regards
Karthik
|
|
|
|

|
The best manual I found on the web.
I had no idea how to make it run with certificates, always something went wrong.
You saved me much time!
Thank you!
|
|
|
|

|
Hi Jason,
I have read through and followed every step mentioned in the Article. Unfortunately the configuration is not working for me and not sure what I have missed. I have come to a stage where I have tried all possible ways to make it work. Please find the stack trace of the error thrown,
////////// ////////// BEGIN OF STACK TRACE //////////////////////////
Secure channel cannot be opened because security negotiation with the remote endpoint has failed. This may be due to absent or incorrectly specified EndpointIdentity in the EndpointAddress used to create the channel. Please verify the EndpointIdentity specified or implied by the EndpointAddress correctly identifies the remote endpoint.
Server stack trace: at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout) at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout) at System.ServiceModel.Security.TlsnegoTokenProvider.OnOpen(TimeSpan timeout) at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open(TimeSpan timeout) at System.ServiceModel.Security.SecurityUtils.OpenCommunicationObject(ICommunicationObject obj, TimeSpan timeout) at System.ServiceModel.Security.SecurityUtils.OpenTokenProviderIfRequired(SecurityTokenProvider tokenProvider, TimeSpan timeout) at System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout) at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Security.SecurityProtocol.Open(TimeSpan timeout) at System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout) at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade) at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at notificationDeliveryPortType.notificationDelivery(notificationDeliveryRequset request) at notificationDeliveryPortTypeClient.notificationDelivery(notificationDeliveryRequset request) at Siemens.DMIPortal.ClientService.NotificationDeliveryService.CreateNotification() at UserControls_SecuredCommunicationWP.Page_Load(Object sender, EventArgs e)
////////// ////////// END OF STACK TRACE //////////////////////////
Please find my Client configuration below,
////////// ////////// BEGIN OF Client CONFIGURATION //////////////////////////
<!-- Below commented code is used to enable WCF logging -->
<!-- The below entries are added for secure communication-->
establishSecurityContext="true"/>
<!-- End of secure communication entries -->
<!-- The below entries are added for secure communication-->
<!-- End of secure communication entries -->
<!-- The below entry is used for securing communication-->
bindingConfiguration="notificationDeliveryBinding"
contract="notificationDeliveryPortType" name="notificationDeliveryPortType"
behaviorConfiguration="notificationDeliveryBehaviour">
<!-- End of Secure Communication entry-->
////////// ////////// END OF CLIENT CONFIGURATION //////////////////////////
Please find the Service Configuration
////////// ////////// BEGIN OF SERVICE CONFIGURATION //////////////////////////
name="Siemens.DMIPortal.notificationDeliveryHost.NotifyDeliveryHost">
name="Siemens.DMIPortal.NotificationDelivery.notificationDeliveryPortTypeClient">
<!-- The below entries are used to secure communication -->
storeName="My" />
////////// ////////// END OF SERVICE CONFIGURATION //////////////////////////
Kindly please guide me through resolving this issue. Any information needed please do let me know.
Cheers!
Amit.
|
|
|
|
|

|
I already have one on my Domain Controller, but the screens are all different!
|
|
|
|

|
Hope you can help me with this. I am fairly new to WCF and created a WCF service and a client, both working fine when on the same server and same website (win2003/iis6). Now I wanted to host WCF services on a separate machine. I created a test environment with two Win2003/IIS6 servers. One hosts WCF services, another one hosts the website that consumes those services. I set up x509 certificates as per this article I ran into a bunch of errors which I resolved and now I am stuck on this error for few days already: The request for security token has invalid or malformed elements. Here's the client code: WCFCategories.CategoriesClient client = new WCFCategories.CategoriesClient(); Textbox1.Text = client.GetCategoriesInXML(611);
Here are my service / client web.config files: SERVICE -------------------- <system.serviceModel>
<services> <service behaviorConfiguration="customBehavior" name="Categories"> <endpoint address="http://s.foo.com:8228/Services/Categories.svc" binding="wsHttpBinding" contract="ICategories"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <bindings> <wsHttpBinding> <binding name="customWsHttpBinding"> <security mode="Message"> <message clientCredentialType="Certificate"/> </security> </binding> </wsHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="customBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> <serviceCredentials> <clientCertificate> <authentication certificateValidationMode="ChainTrust" revocationMode="NoCheck"/> </clientCertificate> <serviceCertificate findValue="My Server Machine" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/> </serviceCredentials> </behavior> </serviceBehaviors> </behaviors>
</system.serviceModel> CLIENT ---------------------------- <system.serviceModel> <client> <endpoint address="http://s.foo.com:8228/Services/Categories.svc" behaviorConfiguration="customBehavior" binding="wsHttpBinding" bindingConfiguration="customWsHttpBinding" contract="WCFCategories.ICategories" name="WSHttpBinding_ICategories"> <identity> <dns value="My Server Machine"/> </identity> </endpoint> </client> <behaviors> <endpointBehaviors> <behavior name="customBehavior"> <clientCredentials> <clientCertificate x509FindType="FindBySubjectName" findValue="My Client Machine" storeLocation="LocalMachine" storeName="My"/> <serviceCertificate> <authentication certificateValidationMode="ChainTrust" revocationMode="NoCheck"/> </serviceCertificate> </clientCredentials> </behavior> </endpointBehaviors> </behaviors> <bindings> <wsHttpBinding> <binding name="customWsHttpBinding"> <security mode="Message"> <message clientCredentialType="Certificate"/> </security> </binding> </wsHttpBinding> </bindings> </system.serviceModel>
|
|
|
|

|
make sure the dns value, match the actual server name
may be it works.
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
An article that describes how to secure WCF services using X.509 certificates issued from a certificate authority.
| Type | Article |
| Licence | CPOL |
| First Posted | 30 Jul 2008 |
| Views | 135,240 |
| Downloads | 1,185 |
| Bookmarked | 182 times |
|
|