【发布时间】:2014-08-22 11:02:06
【问题描述】:
我正在使用 NLog 附带的LogReceiverService 目标来登录到远程日志服务。我的 NLog 配置如下所示:
<target name="loggingservice" type="LogReceiverService" endpointAddress="http://logger:56998/ILoggingService" useBinaryEncoding="False" includeEventProperties="True" />
这很好用。但是,如果我将 endpointAddress 更改为 HTTPS:
<target name="loggingservice" type="LogReceiverService" endpointAddress="https://logger:56998/ILoggingService" useBinaryEncoding="False" includeEventProperties="True" />
然后我得到以下 WCF 异常:
[ArgumentException: The provided URI scheme 'https' is invalid; expected 'http'.
Parameter name: via]
System.ServiceModel.Channels.HttpChannelFactory`1.ValidateCreateChannelParameters(EndpointAddress remoteAddress, Uri via) +17130141
System.ServiceModel.Channels.HttpChannelFactory`1.OnCreateChannelCore(EndpointAddress remoteAddress, Uri via) +52
System.ServiceModel.Channels.ChannelFactoryBase`1.InternalCreateChannel(EndpointAddress address, Uri via) +116
System.ServiceModel.Channels.ServiceChannelFactoryOverRequest.CreateInnerChannelBinder(EndpointAddress to, Uri via) +29
System.ServiceModel.Channels.ServiceChannelFactory.CreateServiceChannel(EndpointAddress address, Uri via) +32
System.ServiceModel.Channels.ServiceChannelFactory.CreateChannel(Type channelType, EndpointAddress address, Uri via) +100
System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via) +564
System.ServiceModel.ClientBase`1.CreateChannel() +58
System.ServiceModel.ClientBase`1.CreateChannelInternal() +48
System.ServiceModel.ClientBase`1.get_Channel() +464
NLog.LogReceiverService.WcfLogReceiverClient.NLog.LogReceiverService.ILogReceiverClient.BeginProcessLogMessages(NLogEvents events, AsyncCallback callback, Object asyncState) +21
System.ServiceModel.ClientBase`1.InvokeAsync(BeginOperationDelegate beginOperationDelegate, Object[] inValues, EndOperationDelegate endOperationDelegate, SendOrPostCallback operationCompletedCallback, Object userState) +249
我可以在浏览器中访问https://logger:56998,它会在收到有关不受信任的证书的警告后正常加载。
我在this post 中尝试了一些建议的绑定配置,但它们都没有任何区别。另外,这些答案都没有真正解释发生了什么,只是关于如何解决它的想法。
【问题讨论】: