我正在尝试在Windows Azure云上部署ASP.NET应用程序。我正在使用Google API进行应用程序中的调用之一。当我这样做时,出现以下错误:

我尝试对此进行研究,但是所有建议都涉及更改IIS服务器设置,由于该服务器正在云中运行,因此我不敢访问它。有人可以帮忙吗?
编辑:这是给出错误的函数的代码:

 Async Function SpecialTest() As Task(Of String)

    Dim credential As UserCredential
    Dim clientSecretsPath As String = Server.MapPath("~/App_Data/client_secret.json")
    Dim scopes As IList(Of String) = New List(Of String)()
    scopes.Add(CalendarService.Scope.Calendar)
    Dim stream As FileStream = New FileStream(clientSecretsPath, System.IO.FileMode.Open, System.IO.FileAccess.Read)

    Using stream
        credential = Await GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, scopes, "user3", CancellationToken.None)
    End Using


    Dim baseInitializer = New BaseClientService.Initializer()
    With baseInitializer
        .HttpClientInitializer = credential
        .ApplicationName = "P1"
    End With

    Dim service = New CalendarService(baseInitializer)


    Dim Calendars = (Await service.CalendarList.List().ExecuteAsync()).Items()
    Dim toReturn As String = "{""items"": ["
    For Each firstCalendar As CalendarListEntry In Calendars


        If firstCalendar IsNot Nothing Then
            ' Get all events from the first calendar.
            Dim calEvents = Await service.Events.List(firstCalendar.Id).ExecuteAsync()
            ' DO SOMETHING
            Dim items = calEvents.Items
            'Return JsonConvert.SerializeObject(calEvents)
            For Each ite As Google.Apis.Calendar.v3.Data.Event In items
                If Not (ite.Location Is Nothing) And Not (ite.Start Is Nothing) Then
                    Dim tst = ite.Start.DateTime
                    toReturn = toReturn + " [""" + Date.Parse(ite.Start.DateTime).ToShortDateString + """" + "," + """" + ite.Location + """" + "," + """" + ite.Start.DateTime + """" + "," + """" + ite.Start.DateTime + """" + "," + """""],"
                End If
            Next

        End If
    Next
    toReturn = toReturn.Substring(0, toReturn.Length - 1)
    Return toReturn + "]}"
End Function`

最佳答案

试试这个。

。如果您具有到Azure云的RDP Acces,则更改IIS设置

  • 1.转到IIS
  • 2.在站点下选择默认站点
  • 3.添加权限
  • 4.选择I_User对象并提供读/写访问权限。
  • 5.以后,您可以自动执行此设置using a batch file and startup task

  • B 。我认为您正在使用任何本地路径。
    您应该将其更改为local storage for temporary requirement and blob storage for long requirement.

    10-05 19:49