【问题标题】:System.IO.FileLoadException while using Google Calendar 3使用 Google 日历 3 时出现 System.IO.FileLoadException
【发布时间】:2014-12-21 04:01:56
【问题描述】:

我正在使用以下代码连接到 Google Calendar 3。

Dim datafolder As String = Server.MapPath("App_Data/CalendarService.api.auth.store")
Dim scopes As IList(Of String) = New List(Of String)()
Dim UserId As String = "101935195xxxxxx-jm6o24ifgbixxxxxxxxxxxx@developer.gserviceaccount.com".Trim()
scopes.Add("https://www.googleapis.com/auth/calendar")
Dim myclientsecret As New ClientSecrets() With { _
  .ClientId = myClientID, _ ' It is saved in the web config
  .ClientSecret = ClientSecret _  ' It is saved in the web config
}

Dim flow As GoogleAuthorizationCodeFlow
Try
    flow = New GoogleAuthorizationCodeFlow(New GoogleAuthorizationCodeFlow.Initializer() With { _
      .DataStore = New FileDataStore(datafolder), _
      .ClientSecrets = myclientsecret, _
      .Scopes = scopes
    })
Catch ex As Exception
    lblerr.Text = ex.ToString
End Try

它抛出:

System.TypeInitializationException:“Google.Apis.Http.ConfigurableMessageHandler”的类型初始化程序引发了异常。

System.IO.FileLoadException:无法加载文件或程序集“系统,版本=2.0.5.0,文化=中性,PublicKeyToken=7cec85d7bea7798e,可重定位=是”或其依赖项之一。给定的程序集名称或代码库无效。 (HRESULT 异常:0x80131047)

我在这个编码中做错了什么?为什么我没有通过身份验证?

【问题讨论】:

    标签: vb.net google-api google-calendar-api


    【解决方案1】:

    在使用从 Internet 下载的外部库(例如 DLL)时,我看到了类似的错误。你的帖子没有提到这一点,但我会在这里发布以防万一这适用于你。

    确保您的项目使用的任何外部库都未被 Windows 阻止。您可以通过右键单击库文件(例如 DLL)并转到 Properties 来执行此操作。在底部,如果适用,将有一个“取消阻止”按钮。单击它,然后尝试再次运行您的项目。

    更多信息和自动化选项可以在这里找到:http://www.howtogeek.com/70012/what-causes-the-file-downloaded-from-the-internet-warning-and-how-can-i-easily-remove-it/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-11
      • 1970-01-01
      • 2022-01-19
      • 2019-06-24
      • 2011-11-01
      相关资源
      最近更新 更多