我在IIS中托管了RESTful WCF服务。它有自己的自定义WebServiceHostFactory和WebServiceHost子类。
现在它的IIS网站配置了TLS和非TLS绑定(都是相同的IP地址)。但是,当一个请求进入不安全的IIS绑定时会发生此错误(隐藏在ASP.NET YSoD中的SGML注释中):
[EndpointNotFoundException]: There was no channel actively listening at 'http://mywebservice.com./MyService.svc/'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() [HttpException]: There was no channel actively listening at 'http://mywebservice.com./MyService.svc/'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
但是我不知道我在哪里设置这些绑定 - 因为我的代码或web.config文件中没有任何地方告诉它首先使用“https://mywebservice.com/MyService.svc”。
我注意到异常详细信息将主机名声明为“mywebservice.com”的根绝对FQDN。而不是“mywebservice.com”的典型根相对FQDN - 这有什么意义吗?
编辑(回应评论):IIS网站有两个绑定,一个HTTP在端口80上绑定到一个IP地址,另一个绑定在端口443上的HTTPS在同一个IP地址上。任何绑定都没有主机标头设置。