public void SetDataFormatter(DataFormatter dataFormatter) { if (Opened) { throw new InvalidOperationException("服务打开时不能更改。"); } if (dataFormatter == null) { throw new ArgumentNullException("dataFormatter"); } DataFormatter = dataFormatter; MessageFormatter = new ChannelMessageFormatter(dataFormatter); }