C# IIS 7.0 Web服务-在HTTP(80)上工作,在HTTPS(443)上失败并出现错误404

C# IIS 7.0 Web服务-在HTTP(80)上工作,在HTTPS(443)上失败并出现错误404,c#,wcf,iis-7,web-config,C#,Wcf,Iis 7,Web Config,Windows 2008上的IIS 7.0 来自VS2010的WCF Web服务.NET 4 Web服务是通过发布安装的,我对服务器拥有完全的管理员权限。有几个复杂的方法,但有一个简单的方法返回构建版本。如果我们能让这一个工作,我可以修复它们-这是我的界面: namespace MyNameSpace { [ServiceContract] public interface WebInterface { [OperationContract]

Windows 2008上的IIS 7.0

来自VS2010的WCF Web服务.NET 4

Web服务是通过发布安装的,我对服务器拥有完全的管理员权限。有几个复杂的方法,但有一个简单的方法返回构建版本。如果我们能让这一个工作,我可以修复它们-这是我的界面:

namespace MyNameSpace
{

    [ServiceContract]
    public interface WebInterface
    {

        [OperationContract]
        [WebGet]
        string GetVersion();
尝试通过HTTP://连接,一切正常

尝试通过HTTPS://I连接未找到404文件

我可以访问通用的“You have created a web service…”页面,包括完整的web service路径和在HTTP和HTTPS上浏览到完全相同的URL时的C#通用示例代码

在C#中,我读到证书可能会引起问题,我已经实现了委托重载来批准我们的服务器证书

我怀疑Web.config文件中缺少一个或多个条目,但我不知道从哪里开始。我尝试过谷歌搜索和堆栈溢出搜索,但是我没有找到正确的搜索词组合来帮助解决这个问题

Web配置:

<system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <behavior name="HttpGetMetadata">
        <serviceDebug includeExceptionDetailInFaults="true"/>
        <serviceMetadata httpGetEnabled="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <services>
    <service name="LinkService" behaviorConfiguration="HttpGetMetadata">
      <endpoint address="" contract="WebInterface" binding="basicHttpBinding" />
    </service>
  </services>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>


请提供帮助。

您使用的是
basicHttpBinding
的默认安全模式,该绑定的默认安全模式为无。您需要在配置中定义绑定并将安全模式设置为
Transport
。将绑定部分添加到ServiceModel部分,如下所示:

<serviceModel>
  <Bindings>
    <basicHttpBinding name="secureBinding">
      <security mode="Transport">
        <transport clientCredentialType="None" />
      </security>
    </basicHttpBinding>
  </Bindings>
</serviceModel>
<endpoint address="" 
          binding="basicHttpBinding" 
          bindingConfiguration="secureBinding"  
          contract="WebInterface" />
您可能还需要启用
httpsGetEnabled

<serviceMetadata httpGetEnabled="true"
                 httpsGetEnabled="true" />

请参阅(这是示例代码的基础)

你也可以用“BasicHttpBinding WCF SSL”之类的术语在谷歌上搜索——网上有很多例子和信息,只需使用正确的词语:)

此外,我不能100%确信transportClientCredential设置是否适合您的场景(它可能需要是
证书
),但我对用于WCF的SSL所做的工作很少


可能还存在其他问题(如如何在您的计算机上设置IIS),但配置需要以上内容

您是否在IIS中为您的网站添加了HTTPS绑定?感谢您的建议,现在我得到以下信息:“客户端发现响应内容类型为‘text/html’,但预期为‘text/xml’@BrianJenkins:我也在同一个bot中。你还记得你是怎么解决这个问题的吗?