用戶端手動建立 Channel 呼叫失敗:「You have tried to create a channel to a service that does not support .Net Framing. It is possible that you are encountering an HTTP endpoint.」。原因:服務端點使用 WSHttpBinding/BasicHttpBinding(HTTP 協定),用戶端卻用 NetTcpBinding 建立 Channel。
// 服務端點為 https://localhost:8002/WCFService (WSHttpBinding)
var binding = new WSHttpBinding(); // 或 BasicHttpBinding
var address = new EndpointAddress("https://localhost:8002/WCFService");
var factory = new ChannelFactory<IWCFService>(binding, address);
原則:**用戶端繫結協定必須與服務端點位址結構一致**。