I'm trying to send documents to a web service in a .Net Core app. But I learned that .Net Core doesn't support 'MTOM'
WSMessageEncoding.Mtom
so I found this WcfCoreMtomEncoder library and thought I could make it work!?? Maybe not...?
Here is what I had before .Net Core
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport)
{
MessageEncoding = WSMessageEncoding.Mtom,
TransferMode = TransferMode.Streamed
};
EndpointAddress endpoint = new EndpointAddress(url);
ChannelFactory<T> channelFactory = new ChannelFactory<T>(binding, endpoint);
var webService = channelFactory.CreateChannel();
Here is what I have after I put in the library
var encoding = new MtomMessageEncoderBindingElement(new TextMessageEncodingBindingElement());
var transport = new HttpTransportBindingElement();
transport.TransferMode = TransferMode.Streamed;
var binding = new CustomBinding(encoding, transport);
EndpointAddress endpoint = new EndpointAddress(url);
ChannelFactory<T> channelFactory = new ChannelFactory<T>(binding, endpoint);
var webService = channelFactory.CreateChannel();
but I'm getting this exception when I create the channel
The provided URI scheme 'https' is invalid; expected 'http'
according to this SO link I need to set the security mode to transport
QUESTION - how do I set the security mode to transport in this WcfCoreMtomEncoder library? I looked through some of the 'HttpTransportBindingElement' properties but didn't really see one to set.