Asked by:
SecurityNegotiationException: Secure channel cannot be opened

Question
-
User-1367616812 posted
The Error is :
The message with Action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
My Service is
<system.serviceModel> <bindings> <wsHttpBinding> <binding name="WSHttpBinding_IUserManagerService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="None"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/> </security> </binding> </wsHttpBinding> </bindings> <services> <service name="UserManager.Service.UserManagerService" behaviorConfiguration="servicebehaviour1"> <endpoint address="~/UserManagerService.svc" contract="UserManager.Service.IUserManagerService" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IUserManagerService"></endpoint> <endpoint binding="mexHttpBinding" contract="IMetadataExchange"></endpoint> </service> </services> <behaviors> <serviceBehaviors> <behavior name="servicebehaviour1"> <!-- To avoid disclosing metadata information, set the values below to false before deployment --> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel>
My Client is
<system.serviceModel> <bindings> <wsHttpBinding> <binding name="WSHttpBinding_IUserManagerService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="Message"> <!--<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />--> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="false"/> </security> </binding> </wsHttpBinding> </bindings> <client> <endpoint address="http://manjayd.prorigo.com/UserManager.Service/UserManagerService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IUserManagerService" contract="UserManagementServiceReference.IUserManagerService" name="WSHttpBinding_IUserManagerService"> <!--<identity> <servicePrincipalName value="host/manjayd.prorigo.com" /> </identity>--> <identity> <dns value="manjayd.prorigo.com"/> <!--<servicePrincipalName value="host/whchoo.xyz.com" />--> </identity> </endpoint> </client> </system.serviceModel>
Stack Trace:
[FaultException: The message with Action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).] System.ServiceModel.Security.SecurityUtils.ThrowIfNegotiationFault(Message message, EndpointAddress target) +5616390 System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingMessageBody(Message incomingMessage, SspiNegotiationTokenProviderState sspiState) +49 [SecurityNegotiationException: 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. ] System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +9442991 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +345 UserManager.Services.Impl.UserManagementServiceReference.IUserManagerService.Logins(String UserName, String password) +0 UserManager.Services.Impl.UserManagementServiceReference.UserManagerServiceClient.Logins(String UserName, String password) in C:\Users\manjayd\documents\visual studio 2010\Projects\DataAccessLayer\UserManager.Services.Impl\Service References\UserManagementServiceReference\Reference.cs:343 UserManager.Services.Impl.ManageUser.ConsumeLogin(String userName, String password) in C:\Users\manjayd\documents\visual studio 2010\Projects\DataAccessLayer\UserManager.Services.Impl\ManageUser.cs:17 MvcUserManagement.Controllers.AccountController.Logins(String UserName, String password) in C:\Users\manjayd\documents\visual studio 2010\Projects\DataAccessLayer\MvcUserManagement\Controllers\AccountController.cs:35 lambda_method(Closure , ControllerBase , Object[] ) +227 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27 System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263 System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343 System.Web.Mvc.Controller.ExecuteCore() +116 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21 System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50 System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9042429 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
<div></div>
Tuesday, November 19, 2013 9:13 AM
All replies
-
User-484054684 posted
Try replacing the mode from None to Message in the service config file.
i.e., <security mode="None"> to <security mode="Message">
Reference: http://stackoverflow.com/questions/2146189/wcf-service-securitynegotiationexception
Tuesday, November 19, 2013 9:56 AM -
User-1367616812 posted
Thanks for your reply.
I tried this it is also not working.
Tuesday, November 19, 2013 11:53 AM