2016-06-08 37 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" />