Jump to content
Seja Membro VIP - Remova Banners de Propagandas, Tenha Liberado Qualquer Download, Além de Acessos em Áreas Exclusivas!! ×
Quer acesso a todas as Áreas do Fórum, até aquelas só para membros VIPs? Também quer poder baixar qualquer ARQUIVO? ×

Erro ao consumir webservice


Recommended Posts


  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  1
  • Content Per Day:  0.00
  • Reputation:   0
  • Achievement Points:  15
  • Solved Content:  0
  • Days Won:  0
  • Status:  Offline

Boa tarde a todos.

Usando o Visual Studio 2019, estou fazendo um projeto em MVC 6 onde preciso consumir um WebService do TOTVS RM, porém sempre que tento fazer a autenticação ou utilizar qualquer método, o sistema me retorna com a mensagem:

MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Basic'. The authentication header received from the server was '*'.

 

Abaixo meu código em .Net:

 

 BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
            var endPoint = new EndpointAddress("http://XXXXXXXX:8051/wsConsultaSQL/IwsBase");

            var cliente = new IwsBaseClient(binding, endPoint); 
            
            cliente.ClientCredentials.Windows.ClientCredential.UserName = codUsuario;
            cliente.ClientCredentials.Windows.ClientCredential.Password = senha;
            cliente.ClientCredentials.UserName.UserName = codUsuario;
            cliente.ClientCredentials.UserName.Password = senha;
            cliente.ChannelFactory.Open(new TimeSpan(5, 59, 59));
            

            await cliente.AutenticaAcessoAsync();

 

Desde já agradeço.

Link to comment
Share on other sites

  • 4 years later...

  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  7
  • Content Per Day:  0.00
  • Reputation:   1
  • Achievement Points:  62
  • Solved Content:  0
  • Days Won:  0
  • Status:  Offline
  • Device:  Windows

Boa noite, conseguiu de alguma forma?

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.