I am getting the "Access Denied" Exception while accessing a third party service.

Below is the binding that i am using (Have changed some name to XXXX,YYYY and OOOO as i don't want to show them)

<system.serviceModel>
<bindings>
  <customBinding>
    <binding name="XXXXSyncBinding">
      <security defaultAlgorithmSuite="Default" authenticationMode="UserNameOverTransport"
        requireDerivedKeys="true" securityHeaderLayout="Lax" includeTimestamp="false">
        <localClientSettings detectReplays="false" />
        <localServiceSettings detectReplays="false" />
      </security>
      <textMessageEncoding messageVersion="Soap11" />
      <httpsTransport />
    </binding>
  </customBinding>
</bindings>
<client>
  <endpoint address="https://OOOO--tls.YYYY.com/cgi-bin/OOOO.cfg/services/soap"
    binding="customBinding" bindingConfiguration="XXXXSyncBinding"
    contract="XXXXService.XXXXSyncPort" name="XXXXSyncPort" />
</client>

the service uses TLS 1.2 and am Passing the credential in header as below

 ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;

_client.ClientCredentials.UserName.UserName = "XYXYXXYXY"; _client.ClientCredentials.UserName.Password = "XYXYXXYXY&123";

But the service always throw the exception

An exception of type 'System.ServiceModel.Security.SecurityAccessDeniedException' occurred in mscorlib.dll but was not handled in user code Additional information: Access Denied

Stack Trace Information

Server stack trace:

Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) 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 WhiteNowWI.WhiteNowService.WhiteNowSyncPort.RunAnalyticsReport(RunAnalyticsReportRequest request) at WhiteNowWI.WhiteNowService.WhiteNowSyncPortClient.WhiteNowWI.WhiteNowService.WhiteNowSyncPort.RunAnalyticsReport(RunAnalyticsReportRequest request) in C:\RahulRathoreWork\PMGWorkSpace\GIT\WhiteNow\Service References\WhiteNowService\Reference.cs:line 24711 at WhiteNowWI.WhiteNowService.WhiteNowSyncPortClient.RunAnalyticsReport(ClientInfoHeader ClientInfoHeader, AnalyticsReport AnalyticsReport, Int32 Limit, Int32 Start, String Delimiter, Boolean ReturnRawResult, Boolean DisableMTOM, Byte[]& FileData) in C:\XXXX\XXX\GIT\XXX\Service References\X\Reference.cs:line 24723 at WhiteNowWI.QueryReport.getData(String username, String password, Int32 report_ID, String delimiter)

Can somebody please help me on this.It would be a great help. Thanks!

1

There are 1 best solutions below

0
On

It has been solved.The Password of the third party service was expired and i came to know this after raising a support request to that third party service.