当前位置: 首页 > 编程语言 > C#

为RESTfulWCF配置SSL绑定,这个怎么样?分享

时间:2023-04-10 13:50:40 C#

为RESTfulWCF配置SSL绑定。这个怎么样?我当前的配置如下:当我为我的网站配置了http和https绑定时,这会起作用。我通过https连接到服务,一切正常。现在我想完全删除IIS上的http绑定。我开始收到这样的错误:找不到与绑定到WebHttpBinding的端点的方案http相匹配的基地址。注册的基地址方案是[https]。[InvalidOperationException:没有为绑定到WebHttpBinding的端点找到基地址匹配方案http。注册的基址方案是[https]。]System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(UrirelativeOrAbsoluteUri,Binding绑定,UriSchemeKeyedCollectionbaseAddresses)+16582113System.ServiceModel.Description.ConfigLoader.ConfigureEndpointAddress(ServiceEndpointElementserviceEndpointElement,ServiceHostBase主机,ServiceEndpoint端点)+117System.ServiceModel.Description.ConfigLoader.ConfigureEndpoint(StandardEndpointElementstandardEndpointElement,ServiceEndpointElementserviceEndpointElement,ContextInformation上下文,ServiceHostBase主机,ServiceDescription描述,ServiceEndpoint&endpoint,BooleanomitSettingEndpointAddress)+937System.ServiceModel.Description.ConfigLoader.LookupEndpoint(ServiceEndpointElementserviceEndpointElement,ContextInformation上下文,ServiceHostBase主机,ServiceDescription描述,Boolean2Address7mit1)tingSystem.ServiceModel.Web.WebServiceHost.AddAutomaticWebHttpBindingEndpoints(ServiceHost主机,IDictionary`2implementedContracts,字符串multipleContractsErrorMessage,字符串standardEndpointKind)+982System.ServiceModel.Web.WebServiceHost.OnOpening()+311System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan超时)+612System.ServiceModel.HostingManager.ActivateService(StringnormalizedVirtualPath)+255System.ServiceModel.HostingManager.EnsureServiceAvailable(StringnormalizedVirtualPath)+1172[ServiceActivationException:由于编译期间出现异常,无法激活服务“/DEMO/mobile”。异常消息是:没有为绑定到WebHttpBinding基地址的端点找到的方案http匹配。注册的基地址方案是[https]..]System.Runtime.AsyncResult.End(IAsyncResult结果)+901424System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult结果)+178702System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncHandlerCompletion(IAsyncResult)+136我找到了大量WCF样本,但RESTWCF在配置方面看起来不同,我想知道为什么它很重要。从我的配置来看-它根本不应该通过SSL工作,但是当https绑定存在时它确实有效..按照错误所说的做......修复你的绑定接受的答案对我不起作用,因为我需要保留我的标准端点元素。我只能通过在我的Web.config中添加该部分来删除我的http绑定,将https绑定保留在IIS中确保不设置name属性,否则这将无法在我的Web.config的相关部分工作:尝试以上是C#学习教程:ConfiguringSSLbindingsforRESTfulWCF。这个怎么样?如果所有分享的内容对你有用,需要进一步了解C#学习教程,希望大家多多关注。本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处: