WCF Receive Reply in UTF-8

Asked

Viewed 205 times

4

I’m consuming a Webservice by means of a Console application.

I receive an object as a return and in this object I need to read an attribute called ReturnMessage.

But the text is disfigured, the same is presented as follows "The ³digo KHAN of Security§the sent.". To fix the problem, I created a method that formats the string passed to UTF-8, follows the code below.

 byte[] bytes = Encoding.Default.GetBytes(texto);
 string textoFormatado = Encoding.UTF8.GetString(bytes);   
 return textoFormatado;

After formatting the message is as follows "Sent Security Code Invalid"

My question is, there’s no way I’ve ever received this feedback on UTF-8 without having to do this conversion?

I figured I could parameterize something in app config. as I did below, but it did not work.

inserir a descrição da imagem aqui

Does anyone have any idea if this is possible?

  • What you did is right, you made sure to set the bindingConfiguration as "Basichttpbinding_ipagador" at endpoint?

1 answer

0

  • The method I did is working perfectly, the problem is that I didn’t want to do this in the code but set this configuration on the web.config

  • I get it... It’s all I know. Hug!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.