Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
403:将WCF服务作为web引用添加到.Net客户端时禁止_Wcf_Ssl_Basichttpbinding_Wcf Endpoint - Fatal编程技术网

403:将WCF服务作为web引用添加到.Net客户端时禁止

403:将WCF服务作为web引用添加到.Net客户端时禁止,wcf,ssl,basichttpbinding,wcf-endpoint,Wcf,Ssl,Basichttpbinding,Wcf Endpoint,我正在尝试将WCF服务从http转换为https 它正在使用自签名证书 我可以使用web浏览器浏览该服务,但当我尝试将其添加为另一个.Net应用程序中的web引用时,出现以下错误: 下载时出错https://localhost:40300/DBService/SPService.svc/_vti_bin/ListData.svc/$metadata。 请求失败,HTTP状态为403:禁止 根据谷歌搜索的结果,我尝试了多种方式编辑web.config,但仍然存在上述错误,无法缩小原因 这是我的we

我正在尝试将WCF服务从http转换为https

它正在使用自签名证书

我可以使用web浏览器浏览该服务,但当我尝试将其添加为另一个.Net应用程序中的web引用时,出现以下错误:

下载时出错https://localhost:40300/DBService/SPService.svc/_vti_bin/ListData.svc/$metadata。 请求失败,HTTP状态为403:禁止

根据谷歌搜索的结果,我尝试了多种方式编辑web.config,但仍然存在上述错误,无法缩小原因

这是我的web.config:

<?xml version="1.0"?>
<configuration>
  <appSettings>
      <add key="DatabaseServer" value="Server2008"/>
      <add key="Database" value="Licensor"/>
      <add key="VerboseLogging" value="True"/>
    </appSettings>
  <system.web>
  <compilation targetFramework="4.0"/>
  <httpRuntime/>
  </system.web>
  <system.serviceModel>
    <services>
            <service name="DBService.SPService">
                <endpoint address="https://localhost/DBService/SPService.svc"
                        binding="basicHttpBinding"
                        bindingConfiguration="secureHttpBinding"
                        contract="DBService.IService1"/>

                <endpoint address="mex"
                        binding="mexHttpsBinding"
                        contract="IMetadataExchange" />
            </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="secureHttpBinding">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <!--<protocolMapping>
      <add binding="basicHttpsBinding" scheme="https"/>
    </protocolMapping>-->
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>
有人能帮我找到原因吗,或者更好地告诉我使用basicHttpBinding通过SSL的WCF的工作示例


我已经花了好几个小时试图解决这个问题,所以非常感谢你花时间在这个问题上。如果需要,我可以提供对我的计算机的访问。

您不需要指定要在端点声明中使用的证书吗?仅用于添加引用如何。很抱歉,可能是重复的,我应该提到它托管在Windows 8上的IIS 8.5中。证书已添加到IIS并用于网站的绑定@蒂姆:在这种情况下,我还需要提到证书吗?@Andy:我不明白:你的意思是把那个地址用作网络参考吗?这就是我想做的。