2010-11-22 89 views
1
HttpContext.Current.Request.ServerVariables["SERVER_PORT"] 

&服務器端口返回null

HttpContext.Current.Request.ServerVariables["SERVER_PORT_SECURE"] 

回報null當通過Web服務代碼調用。

任何想法爲什麼?

回答

0

嘗試在您的WebService代碼中使用Context.Request.ServerVariables[]

編輯
根據this

有 無論是SoapRpcMethodAttribute或 SoapDocumentMethodAttribute屬性 適用於他們設置爲true的單向 財產,沒有XML Web服務方法 使用 靜態Current屬性訪問其HttpContext。要訪問 HttpContext,請從WebService派生實現XML Web服務 方法的類 ,並訪問 上下文屬性。

這是否適用於您?

+0

這沒有幫助,順便說一句「HttpContext.Current」返回null。 – Sharpeye500 2010-11-22 18:44:15