1
以下のコードは、ローカルで素晴らしい動作をします。しかし、ホストに公開して実行すると、20秒かかり、「リモートサーバーに接続できません」と応答します。asmxを呼び出してfacebookをオープングラフにするAuth_Token、ローカルで動作、サーバで失敗する
編集:私のホストに従って: 'WebPermissionはHTTPリクエストを実行します。外部のXML Webサービスを使用する
function getAuthCode() {
$.ajax({
type: "POST",
cache: false,
url: "backend.asmx/getAuthCode",
contentType: "application/json",
dataType: "json",
success: function (data) {
//do whatever
},
error: function (request, status, error) {
alert('getAuthCode ERROR: ' + error);
}
});
};
ASMX:私のウェブホストは、任意のHTTP要求のプロキシを必要と発見
<WebMethod()> _
Public Function getAuthCode() As String
Dim appID As String = "<my appid>"
Dim secretCode As String = "<my apps secret code>"
Dim authURL As String = "https://graph.facebook.com/oauth/access_token?client_id=" + appID + "&client_secret=" + secretCode + "&grant_type=client_credentials"
Try
Dim webClient As New System.Net.WebClient
Dim result As String = webClient.DownloadString(authURL)
Return result
Catch ex As Exception
Return ex.Message
End Try
End Function
サービスにアクセスするために必要なポートが開いているかどうかを確認してください – Adil