【发布时间】:2016-06-08 06:30:09
【问题描述】:
我已经设置了一个托管在 IIS 中的 WCF 服务。托管它的服务器没有 DNS 名称(没有域),只有一个外部静态 WAN IP 地址。
当我尝试使用 MEX 连接到 iOS 或 Windows 客户端中的服务以生成代理时,它使用的域名无法解析并失败。
WSDL 文档包含无法解析的链接。 - 下载“https://blah.com.au/NimThaiService.svc?xsd=xsd3”时出错。 - 无法解析远程名称:'blah.com.au'
如何更改我的 Web 配置文件或配置 IIS,以便使用静态 IP 而不是使用域名。
我需要 MEX 为 https://123.123.123.123/NimThaiService.svc
我已尝试按照其他文章中的说明进行操作。例如,建议添加<useRequestHeadersForMetadataAddress />。但是当我这样做时,我会收到一条错误消息,指出找不到资源。
我的网络配置文件如下:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpsGetEnabled="true"/>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="NimThaiService.Authenticator, NimThaiService" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="NimThaiService.NimThaiService">
<endpoint address="https://mystaticwanipaddress:443/NimThaiService.svc" binding="basicHttpBinding" contract="NimThaiService.INimThaiService" bindingConfiguration="secureHttpBinding">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange">
<identity>
<dns value="mystaticwanipaddress" />
</identity>
</endpoint>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="secureHttpBinding">
<security mode="Transport">
<transport clientCredentialType="Basic" />
<message clientCredentialType="UserName"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
【问题讨论】: