我正在使用Google Analytics核心報告API。我可以用這樣的代碼成功運行我的請求。Google Analytics GetRequest錯誤:System.Net版本2.0.5.0需要查看HttpStatusCode
DataResource.GaResource.GetRequest requestData = googleAnalyticsService.Data.Ga.Get(profiles, startDateStr, endDateStr, metrics);
requestData.Dimensions = dimensions;
requestData.MaxResults = Globals.MAX_RESULTS;
responseData = requestData.Execute();
因此,在我的responseData
對象中,我擁有了所有我需要的數據。但我也需要知道我的請求中有何錯誤。所以我需要趕上具有HttpStatusCode
屬性的GoogleApiException
。這個Http狀態代碼會讓我知道,如果我每天達到了我的請求配額,那麼我可以在24小時後繼續接收信息。但是,當我趕上這樣的異常:
catch (GoogleApiException gapiex)
{
logger.WriteToLog("GETPROFILEDATA", "Google API exception: " + gapiex.HttpStatusCode);
break;
}
我得到一個錯誤,指出:
The type 'System.Net.HttpStatusCode' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.
,似乎我不能既不能通過的NuGet也沒有其他地方找到庫。 是否有另一種獲取狀態碼的方法,或者是否有人將庫存在某處?
嗨,對於信息:我的項目運行在Windows Server 2003 SP2上的ISS 6.0中。我的項目使用Google.Apis,並在服務器上發生這樣的錯誤。我試圖用這個鏈接修補框架,但它有一些先決條件更新。請不要忘記事先安裝它們。 它們是KB2600217和KB2533523。我可以用windows update補丁框架。 – whitestream