Https wcf webservice错误

时间:2015-12-11 18:29:40

标签: c# asp.net web-services wcf rest

<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<endpointBehaviors>
<behavior name="webHttp">
  <webHttp />
 </behavior>
 <behavior name="webHttpBehavior">
 <webHttp />
 </behavior></endpointBehaviors>
     </behaviors>
  <services>
  <service name="Implementation.Service" behaviorConfiguration="serviceBehavior">
  <endpoint address="" binding="basicHttpBinding"   contract="Contract.IService" behaviorConfiguration="web"    bindingConfiguration="basicHttpBinding"></endpoint>
 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
  </services>
  <bindings>
  <basicHttpBinding>
   <binding name="CodeItSoap" closeTimeout="00:01:00">
   <security mode="Transport">
   <transport clientCredentialType="Basic" proxyCredentialType ="Basic"  realm =" "/>
 <message clientCredentialType= "username" algorithm ="default">
  </security>
 </binding>
 </basicHttpBinding>
 </bindings>
  <client>
 <endpoint address="https://******.****-***/*****_*****?SOAP"
  binding="basicHttpBinding" bindingConfiguration="CodeItSoap"
 contract="Service.CodeItSoap" name="CodeItSoap" />
</client>
 </system.serviceModel>
 </configuration>

这只是我的web.config文件的一个示例。当我在本地主机上运行该服务时,它运行良好,并在wcf测试客户端的帮助下,我得到了所需的输出。 但是,当我把dlls&amp;我需要托管服务的服务器中的web.config会抛出错误  "Could not find a base address that matches scheme HTTP for the endpoint with binding BasicHttpBinding. Registered base address schemes are [https]"

有谁能告诉我上述错误的原因是什么? 我的网络服务的一般流程  申请 - &gt;服务器托管(calc.svc) - &gt; HTTPS:?//******.****-的 * / ***** _ ***** SOAP(认证) 当我添加服务引用app.config生成时,默认情况下basichttpbinding已添加到app.config文件中。 根据我的理解,web.config文件用于在iis&amp ;;中托管服务。我认为我的web.config是错误的。 在客户端点应该是calc.svc或https:// * ?soap的终点? https://prd36/calc.svc网址的basichttpbinding是否正常? 我是否还需要为应用程序指定一个更多绑定? 请帮助我理解我很困惑,因为我编辑的web.config是一个仍在运行旧服务引用的现有文件。

2 个答案:

答案 0 :(得分:1)

 <serviceMetadata httpsGetEnabled="true"/> 
 <endpoint address="json" binding="webHttpBinding" contract="Contract.IService" behaviorConfiguration="web"></endpoint> 
 <endpoint address="mex" binding="mexHttpsinding" contract="IMetadataExchange"/>

我做了以上更改,服务网址在网络浏览器中运行。

答案 1 :(得分:0)

在您的终端地址中使用 http:// 而不是 https:// 。 要么 用户 BasicHttpsBinding ,而不是终端中的 BasicHttpBinding

如果问题仍然存在,请关注this link

相关问题