2016-06-08 59 views
0

我已经在IIS中设置了托管的WCF服务。它所在的服务器没有DNS名称(无域名),只是外部静态WAN IP地址。在IIS中为WCF使用静态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 />。但是当我这样做时,我得到一个错误,说该资源无法找到。

我的Web配置文件如下:

<?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> 

回答

0

一些更多的研究,我设法增加一个属性到serviceMetadata节点来解决此之后。

我需要添加 “httpsGetUrl” 属性如下:

<serviceMetadata httpsGetEnabled="true" httpsGetUrl="http://mystaticwanipaddress/NimThaiService.svc/basic" />