.net - 使用 WCF (https) 时 WSDL 超链接中的 URL 错误

标签 .net wcf https mex

我的 WCF 服务使用 HTTPS 运行,它显示信息页面,但“要测试此服务,...使用以下语法:”下面的 URL 是:

svcutil.exe https://servername.group.service.com/MyService.svc?wsdl (服务器的完整地址)

而不是正确的 URL https://my.service.com/MyService.svc?wsdl (分配的主机头),我怎样才能让它显示正确的URL( <URL of the Service> + ?wsdl )?

<services>
  <service name="MyService" behaviorConfiguration="MyServer.MyServiceBehavior">
    <endpoint binding="basicHttpBinding" bindingConfiguration="basicHttpBigStrings" contract="IMyService">
    </endpoint>
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="MyService.MyServiceBehavior">
      <serviceCredentials>
        <serviceCertificate findValue="my.service.com" x509FindType="FindBySubjectName"/>
      </serviceCredentials>
      <serviceMetadata httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="basicHttpBigStrings">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
      <readerQuotas maxStringContentLength="1048576" />
    </binding>
  </basicHttpBinding>
</bindings>

我已经尝试更改 <serviceMetadata httpsGetEnabled="true"/>进入<serviceMetadata httpsGetEnabled="true" httpsGetUrl="https://my.service.com/MyService.svc"/>但它只是说:“URI https://my.service.com/MyService.svc 的注册已存在”

最佳答案

您指定已设置主机 header 。是设置为 SSL 还是只是 Http。请记住,IIS UI 没有为 SSL 设置主机 header 的字段。对于更高版本的 IIS,您需要使用管理脚本 (IIS 6.0) 或 netsh.exe。

关于.net - 使用 WCF (https) 时 WSDL 超链接中的 URL 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3750945/

相关文章:

.net - 将 Cocoa 版本的 MVC 与 .NET 结合使用有什么好处吗?

c# - 是否可以将lambda表达式存储在数组C#中

mod-rewrite - SSL 重写重定向 apache2

url - 从 Nginx 服务器上的特定 url 中删除 index.php

c# - .NET 程序集版本中保留的最大值

.net - FluentMigrator.Runner 在输出目录中复制 32 位程序集

wcf - 如何在编码器级别确定 WCF 消息大小

.net - Compact Framework(Windows Mobile)中是否有 System.Runtime.Serialization.DataContractAttribute 的解决方法或替代方案

wcf - 从 WCF 使用 TPL 任务

ssl - CSR 是唯一的吗?