2012-06-23 33 views
4

我一直在玩azure網站。我正在使用一些Google API,但似乎一旦部署在Azure WebSites上,就會在請求Google Apis時出現問題:Azure WebSites和Google Api

請求已中止:無法創建SSL/TLS安全通道。

我不確定它來自哪裏,因爲我可以使用HTTPS瀏覽我的網站,也許它來自IIS ARR插件?

編輯 我加入一些代碼

@mcollier我使用的Web客戶端撥打電話。它會失敗在下載結果(HTTP GET請求)

try 
    { 
    WebClient webClient = new WebClient(); 

    string request = string.Format("https://www.googleapis.com/books/v1/volumes?q=intitle:{0}&fields=items(volumeInfo)&maxResults=1&printType=books&key={1}", infos.Value, ConfigurationHelper.GoogleKey); 
    content = webClient.DownloadString(request); 
    }    
    catch (Exception ex) 
    { 
     throw new Exception("content from WebClient : " + content, ex); 
     // Log. 
    } 
+0

你可以發佈一個小的更多信息? Windows Azure網站不應禁止您訪問任何其他Web服務。 Google API只是一個普通的HTTP/HTTPS GET請求嗎? – mcollier

+0

這是否可以在開發機器上使用Windows Azure模擬器工作? – user728584

+0

@ user728584你好,因爲天青網站是一個普通的網站,它並不需要所有的天藍色sdk的東西運行。這些調用在我的本地機器上工作。 – Ronny

回答

3

添加這在Global.asax.cs中你的Application_Start應該解決您的問題:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; 
+0

其實我試過這個,但我沒有在正確的地方打電話。謝謝!它現在可以工作 – Ronny

+0

請注意,此問題也會影響Exchange Web服務API,並且此工作不會解決此問題。至少對於我來說。 – tig