2016-04-26 50 views
1

我創建了示例Asp.net應用程序以獲取日曆中的所有日曆和添加事件。我的應用程序工作正常,當我使用Visual Studio運行它時,它成功加載頁面,顯示所有日曆信息,在calendar.But添加事件,當我部署在IIS上的應用程序,網頁加載從來沒有和它給出了「請求超時」 exception.Kindly幫助Google Calendar Api> IIS上的網絡超時異常

以下是代碼

private CalendarService InitGoogleService() 
{ 
UserCredential credential; 
string path = Server.MapPath("~") + @"\GCSc.json"; 
string credPath = Server.MapPath("~") + @"\Calendar_Data"; 
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets 
{ 
ClientId = "My Client Id",`enter code here` 
ClientSecret = "My Client Secret" 
}, Scopes, "user", CancellationToken.None, new Google.Apis.Util.Store.FileDataStore(credPath)).Result; 

    CalendarService service = new CalendarService(new BaseClientService.Initializer() 
    { 
     HttpClientInitializer = credential, 
     ApplicationName = ApplicationName, 
    }); 
    return service; 
} 

Request Timeout Exception enter image description here

+0

當您部署它時它是否請求驗證?你有什麼重定向uri設置? IIS運行的是哪個應用程序池?服務器上的credPath目錄中是否有任何內容? – DaImTo

+0

我在過去曾多次看到過這個問題,我認爲我們認爲它的時間我們很好,我會嘗試重新創建您的問題。 – DaImTo

+0

任何更新來解決問題? – Mudasser

回答

0

我們有同樣的問題。 在Visual Studio中沒有問題,但是當我發佈到IIS時,代碼會創建超時。

當下面的代碼在本地執行時,它會創建一個彈出窗口,用於輸入憑據或選擇帳戶。在IIS上,彈出窗口不會出現,因此應用程序會創建超時。

public static void GetYutubeAccesToken(string id, string secret) 
    {  
     List<SocialMediaItems> lstSocialItems = new List<SocialMediaItems>(); 
     UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
       new ClientSecrets 
       { 
        ClientId = id, 
        ClientSecret = secret 
       }, 
       new string[] { YouTubeService.Scope.YoutubeReadonly }, 
       "user", 
       CancellationToken.None, 
       new FileDataStore(HttpContext.Current.Server.MapPath("~/files/accesToken")) 
      ).Result; 
    } 
+0

以及答案是什麼? – Marwie