BasicHttpBinding.TextEncoding BasicHttpBinding.TextEncoding BasicHttpBinding.TextEncoding BasicHttpBinding.TextEncoding Property

定义

获取或设置用于消息文本的字符编码。Gets or sets the character encoding that is used for the message text.

public:
 property System::Text::Encoding ^ TextEncoding { System::Text::Encoding ^ get(); void set(System::Text::Encoding ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.ServiceModel.Configuration.EncodingConverter))]
public System.Text.Encoding TextEncoding { get; set; }
member this.TextEncoding : System.Text.Encoding with get, set
Public Property TextEncoding As Encoding

属性值

用于指示所使用的字符编码的 EncodingThe Encoding that indicates the character encoding that is used. 默认值为 UTF8EncodingThe default is UTF8Encoding.

示例

下面的示例将 TextEncoding 设置Encoding.Unicode为。The following example sets TextEncoding to Encoding.Unicode.

BasicHttpBinding binding = new BasicHttpBinding();
binding.TextEncoding = System.Text.Encoding.Unicode;

也可以在配置文件中设置此属性的值。The value of this property can also be set in the configuration file.

<configuration>
  <system.serviceModel>

    <bindings>
      <basicHttpBinding>
        <binding name="Binding1"
          textEncoding = "UnicodeFffeTextEncoding">

          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>
  </system.serviceModel>

</configuration>

适用于