对“https://accounts.google.com/o/oauth2/token”的网络请求失败。没有连接可能...目标机器主动拒绝它173.194.70.84:443

时间:2013-05-15 10:01:53

标签: google-analytics google-api google-analytics-api

我正在构建一个通过谷歌分析获取数据的应用程序。为此,我已经从Google API控制台和我的.NET webform应用程序中创建了一个服务帐户信息,成功地通过以下代码获取数据:

string clientEmailId = ConfigurationManager.AppSettings.Get("clientEmailId");
string keyFile = AnalyticsKeyFileInitialPath + ConfigurationManager.AppSettings.Get("keyFile");
string keyPass = ConfigurationManager.AppSettings.Get("keyPass");
var desc = GoogleAuthenticationServer.Description;
var key = new X509Certificate2(keyFile, keyPass, X509KeyStorageFlags.Exportable);
var client = new AssertionFlowClient(desc, key) { ServiceAccountId = clientEmailId, Scope = scopeUrl };
var auth = new OAuth2Authenticator<AssertionFlowClient>(client, AssertionFlowClient.GetState);
var gas = new AnalyticsService(new BaseClientService.Initializer
{
    Authenticator = auth
});
//auth.LoadAccessToken();
var accounts = gas.Management.Accounts.List().Fetch();

现在我通过WCF服务调用相同的代码但是出现以下错误

  

异常消息:无法连接到远程服务器   内部异常:对“https://accounts.google.com/o/oauth2/token”的Web请求失败。   内部异常:无法建立连接,因为目标计算机主动拒绝它173.194.70.84:443

知道我可能做错了吗?

0 个答案:

没有答案
相关问题