【发布时间】:2012-03-03 18:51:13
【问题描述】:
我当前的配置如下:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<webHttpEndpoint>
<!--Set limit to 5 megabytes-->
<standardEndpoint helpEnabled="true" automaticFormatSelectionEnabled="true" maxReceivedMessageSize="5242880">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</standardEndpoint>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
当我为我的网站配置了http 和 https 绑定时,此方法有效。
我通过 https 连接到服务,一切正常。
现在我想完全删除 IIS 上的 http 绑定。我开始收到这样的错误:
找不到与方案 http 匹配的基地址 具有绑定 WebHttpBinding 的端点。注册的基地址方案 是 [https]。
[InvalidOperationException: 找不到匹配的基地址 具有绑定 WebHttpBinding 的端点的方案 http。挂号的 基地址方案是 [https]。]
System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(Uri relativeOrAbsoluteUri,绑定绑定,UriSchemeKeyedCollection 基本地址)+16582113
System.ServiceModel.Description.ConfigLoader.ConfigureEndpointAddress(ServiceEndpointElement serviceEndpointElement、ServiceHostBase 主机、ServiceEndpoint 端点)+117
System.ServiceModel.Description.ConfigLoader.ConfigureEndpoint(标准端点元素 标准端点元素、服务端点元素 serviceEndpointElement、ContextInformation 上下文、ServiceHostBase 主机,ServiceDescription 描述,ServiceEndpoint& 端点, 布尔省略SettingEndpointAddress) +937
System.ServiceModel.Description.ConfigLoader.LookupEndpoint(ServiceEndpointElement serviceEndpointElement、ContextInformation 上下文、ServiceHostBase 主机,ServiceDescription 描述,布尔值 省略SettingEndpointAddress) +8728167
System.ServiceModel.Web.WebServiceHost.AddAutomaticWebHttpBindingEndpoints(ServiceHost 主机,IDictionary`2 实施合同,字符串 multipleContractsErrorMessage,字符串标准端点种类)+982
System.ServiceModel.Web.WebServiceHost.OnOpening() +311
System.ServiceModel.Channels.CommunicationObject.Open(时间跨度 超时)+612
System.ServiceModel.HostingManager.ActivateService(字符串 标准化虚拟路径)+255
System.ServiceModel.HostingManager.EnsureServiceAvailable(字符串 normalizedVirtualPath) +1172[ServiceActivationException: 服务 '/DEMO/mobile' 不能 由于编译期间的异常而激活。例外 消息是:找不到与方案 http 匹配的基地址 具有绑定 WebHttpBinding 的端点。注册基址 方案是 [https]..] System.Runtime.AsyncResult.End(IAsyncResult 结果)+901424
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult 结果)+178702
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +136
我为 WCF 找到了一堆示例,但 REST WCF 在配置方面看起来不同,我想了解它的原因为什么。从我的配置来看 - 它根本不应该通过 SSL 工作,但它确实在存在 https 绑定时工作..
【问题讨论】:
-
如果您想删除 IIS 上的 http 绑定,只需右键单击网站选择编辑绑定选项并从绑定列表中删除 http 协议。应该够了
-
没有。如果我这样做 - 我会收到我发布的错误。
-
您是否尝试使用 http 访问该 url?
-
不。我只想离开 HTTPS。如果我删除 http 绑定,我会收到此错误
-
您能否创建一个新网站并仅映射 https 绑定并将您的应用程序部署到该网站并检查是否可行?
标签: c# .net wcf rest web-config