2011-07-13 32 views
0

使用Visual Studio 2010/.NET 4.0部署WCF - 需要設置一個SSL網站

我已經在這幾個小時,但我會盡量特定的主機頭。

我正在向IIS 7部署WCF 4.0服務。它在http下工作正常。我可以添加從Visual Studio的服務參考對WCF服務和代碼對它沒有問題。

當然問題是服務需要在https下運行。

我已經設法處理web.config文件,所以它將在https下運行(至少我可以在瀏覽器中看到.svc和?wsdl顯示)。

但是,當然IIS會返回機器名稱,而不是整個wsdl中的域名。

所以當我嘗試添加服務引用時,我得到了這樣的提示。

該文件被理解,但無法處理。 - WSDL文檔包含無法解析的鏈接。 - 下載'https://machinename/MyServiceName.svc?xsd = xsd0'時出錯。 - 無法解析遠程名稱:'machinename'

我知道問題是IIS沒有返回主機標題,所以WCF猜測並交還了機器名稱。

當然,IIS7不允許我將主機標頭添加到使用SSL的站點。我GOOGLE和看過別人設置的主機頭使用APPCMD像這樣

appcmd設置站點/site.name:/+bindings.[protocol='https',bindingInformation='*:443:']

嘗試過了,它告訴我,該網站已被修改

但是相反modifiying現有的SSL綁定的,我得到一個額外的結合具有主機名,但連接到它沒有證書。任何嘗試通過IIS UI選擇SSL都會清除主機名。我正在使用GoDaddy的通配符證書

1)任何人都可以通過appcmd看到這個問題嗎?對如何解決有任何想法。 2)我可以在webconfig中設置域名嗎?我迄今爲止所做的所有嘗試都產生了各種IIS黃屏死機抱怨一個參數或另一個參數。我收錄了一份用於娛樂和建議的副本。

<services> 
    <service name ="NameThisService" behaviorConfiguration="TheDefaultBehaviour"> 
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="webBinding" contract="IService" > 
    </endpoint> 


    </service> 
</services> 

<bindings> 
    <wsHttpBinding> 
    <binding name="webBinding"> 
     <security mode="Transport"> 
     <transport clientCredentialType="None"/> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings > 


<behaviors> 
    <serviceBehaviors> 
    <behavior name="TheDefaultBehaviour"> 
     <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
     <serviceMetadata httpsGetEnabled="true" /> 
     <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
     <serviceDebug includeExceptionDetailInFaults="false"/> 

    </behavior> 
    </serviceBehaviors> 
</behaviors> 




<serviceHostingEnvironment multipleSiteBindingsEnabled="false"/> 

回答

0

如果在命令行不工作,你可以做到這一點的UI。您需要隨身攜帶證書的友好名稱。下方鏈接。

http://blog.armgasys.com/?p=80