问题
Last Friday, execution of videosInsertRequest.UploadAsync in my EXE worked fine. Today, Monday, two exceptions are returned via the Response_Received event handler: Response status code does not indicate success: 400 (Bad Request). followed by Value cannot be null. Parameter name: baseUri.
Execution of GoogleWebAuthorizationBroker.AuthorizeAsync, ChannelsResource.ListRequest, VideoCategoriesResource.ListRequest continue to work fine.
There has been no change in the program's code over the weekend.
Any ideas?
NuGet package versions:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Google.Apis" version="1.8.2" targetFramework="net40" />
<package id="Google.Apis.Auth" version="1.8.2" targetFramework="net40" />
<package id="Google.Apis.Core" version="1.8.2" targetFramework="net40" />
<package id="Google.Apis.YouTube.v3" version="1.8.1.1080" targetFramework="net40" />
<package id="log4net" version="2.0.3" targetFramework="net40" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net40" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net40" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net40" />
<package id="Microsoft.Net.Http" version="2.2.22" targetFramework="net40" />
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net40" />
<package id="Zlib.Portable" version="1.10.0" targetFramework="net40" />
</packages
回答1:
This problem was caused by my error. I am sorry for the false alarm.
I had queued a video in my database using the Google API V2 version of my program. That version of the program stored the CategoryId in my database differently than the API V3 version.
I would like to be able to report the actual error returned (InvalidCategoryId) but have been unable to find where I can retrieve that using the .NET Client library.
From Fiddler:
{
"error": {
"errors": [
{
"domain": "youtube.video",
"reason": "invalidCategoryId",
"message": "Bad Request",
"locationType": "other",
"location": "body.snippet.categoryId"
}
],
"code": 400,
"message": "Bad Request"
}
}
来源:https://stackoverflow.com/questions/24736721/google-api-v3-videosinsertrequest-uploadasync-returns-response-status-code-doe