c# – 为RESTful WCF配置SSL绑定.怎么样?
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了c# – 为RESTful WCF配置SSL绑定.怎么样?,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3586字,纯文字阅读大概需要6分钟。
内容图文
![c# – 为RESTful WCF配置SSL绑定.怎么样?](/upload/InfoBanner/zyjiaocheng/791/c67aeaf3b96a40a1ad8319c1899f457a.jpg)
我当前的配置如下:
<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绑定.我开始得到这样的错误:
Could not find a base address that matches scheme http for the
endpoint with binding WebHttpBinding. Registered base address schemes
are [https].[InvalidOperationException: Could not find a base address that matches
scheme http for the endpoint with binding WebHttpBinding. Registered
base address schemes are [https].]
System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(Uri
relativeOrAbsoluteUri, Binding binding, UriSchemeKeyedCollection
baseAddresses) +16582113
System.ServiceModel.Description.ConfigLoader.ConfigureEndpointAddress(ServiceEndpointElement
serviceEndpointElement, ServiceHostBase host, ServiceEndpoint
endpoint) +117
System.ServiceModel.Description.ConfigLoader.ConfigureEndpoint(StandardEndpointElement
standardEndpointElement, ServiceEndpointElement
serviceEndpointElement, ContextInformation context, ServiceHostBase
host, ServiceDescription description, ServiceEndpoint& endpoint,
Boolean omitSettingEndpointAddress) +937
System.ServiceModel.Description.ConfigLoader.LookupEndpoint(ServiceEndpointElement
serviceEndpointElement, ContextInformation context, ServiceHostBase
host, ServiceDescription description, Boolean
omitSettingEndpointAddress) +8728167
System.ServiceModel.Web.WebServiceHost.AddAutomaticWebHttpBindingEndpoints(ServiceHost
host, IDictionary`2 implementedContracts, String
multipleContractsErrorMessage, String standardEndpointKind) +982
System.ServiceModel.Web.WebServiceHost.OnOpening() +311
System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan
timeout) +612
System.ServiceModel.HostingManager.ActivateService(String
normalizedVirtualPath) +255
System.ServiceModel.HostingManager.EnsureServiceAvailable(String
normalizedVirtualPath) +1172[ServiceActivationException: The service ‘/DEMO/mobile’ cannot be
activated due to an exception during compilation. The exception
message is: Could not find a base address that matches scheme http for
the endpoint with binding WebHttpBinding. Registered base address
schemes are [https]..] System.Runtime.AsyncResult.End(IAsyncResult
result) +901424
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult
result) +178702
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult
ar) +136
我为WCF找到了大量样本,但是REST WCF在配置方面看起来不同,我想知道它为什么会重要.从我的配置的外观 – 它根本不应该在SSL上工作,但它在https绑定存在时确实有效..
解决方法:
做错误说的…修复你的绑定
<services>
<service name="service" behaviorConfiguration="serviceBehavior">
<endpoint address="" binding="webHttpBinding"
bindingConfiguration="https"
contract="IContract" behaviorConfiguration="endpointBehavior">
</endpoint>
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="https" maxReceivedMessageSize="65536">
<security mode="Transport" />
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</webHttpBinding>
</bindings>
内容总结
以上是互联网集市为您收集整理的c# – 为RESTful WCF配置SSL绑定.怎么样?全部内容,希望文章能够帮你解决c# – 为RESTful WCF配置SSL绑定.怎么样?所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。