For posterity, this was resolved by a combination of adding the following code to the web.config, as well as trying to upload fewer as in one go.
<system.net> <settings> <servicePointManager expect100Continue="false"/> </settings> </system.net> Thanks, Conor On Thursday, 2 October 2014 17:20:40 UTC+1, testa...@geeks.ltd.uk wrote: > > Just as a note, on some occasions, the inner exception changes to 'Unable > to write data to the transport connection: An established connection was > aborted by the software in your host machine.' rather than 'Unable to write > data to the transport connection: An existing connection was forcibly > closed by the remote host.'. > > No pattern is immediately obvious to explain this. > > Thanks, > Conor > > On Thursday, 2 October 2014 13:49:54 UTC+1, testa...@geeks.ltd.uk wrote: >> >> Hi Anash, >> >> Has there been any progress? >> >> Thanks again for your help. >> >> Best wishes, >> Conor >> >> On Monday, 29 September 2014 20:37:00 UTC+1, Anash P. Oommen (AdWords API >> Team) wrote: >>> >>> Hi Conor, >>> >>> I'd need some additional details, please share them by using the "*Reply >>> to Author*" option. DO NOT post any of these details online. >>> >>> 1. Your customer ids (client and API MCC accounts). >>> 2. When was this call made? (timestamp) >>> 3. Outgoing and incoming http request body. You can capture one using >>> Fiddler ( >>> http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/FirefoxHTTPS) >>> 4. Can you actually access the wsdl url from a browser? e.g. >>> https://adwords.google.com/api/adwords/cm/v201406/CampaignService?wsdl >>> 5. Provide the output when you do a tracert from your server to AdWords >>> server. tracert adwords.google.com >>> 6. What is your machine's IP? (output of ipconfig /all). Another option >>> is to visit these urls and provide the output >>> >>> https://ipv4.google.com/search?q=what+is+my+ip >>> https://ipv6.google.com/search?q=what+is+my+ip >>> >>> Cheers, >>> Anash P. Oommen, >>> AdWords API Advisor. >>> >>> On Monday, September 29, 2014 9:36:23 AM UTC-4, testa...@geeks.ltd.uk >>> wrote: >>>> >>>> Hi Anash, >>>> >>>> I have managed to replicate this error several times now. Same >>>> exception and inner exception each time. What should I do? >>>> >>>> Thanks, >>>> Conor >>>> >>>> >>>> On Monday, 29 September 2014 14:20:47 UTC+1, Anash P. Oommen (AdWords >>>> API Team) wrote: >>>>> >>>>> Hi Conor, >>>>> >>>>> See if you can replicate this one - connection getting closed is >>>>> sometimes related to a bad ISP connection, sometimes it happens due to >>>>> your >>>>> calls happening when a server update is happening. >>>>> >>>>> Cheers, >>>>> Anash P. Oommen, >>>>> AdWords API Advisor. >>>>> >>>>> On Monday, September 29, 2014 5:53:10 AM UTC-4, testa...@geeks.ltd.uk >>>>> wrote: >>>>>> >>>>>> Hi Anash, >>>>>> >>>>>> Thank you for your reply. I made a couple of changes to my code, so >>>>>> it now looks like this: >>>>>> >>>>>> var operations = new List<AdGroupAdOperation>(); >>>>>> >>>>>> foreach (var generatedAd in generatedAds) >>>>>> { >>>>>> // create a new image to put in the imageAd >>>>>> var image = new Image >>>>>> { >>>>>> data = generatedAd.Image.FileData, >>>>>> type = MediaMediaType.IMAGE >>>>>> }; >>>>>> >>>>>> // create a new image ad >>>>>> var imageAd = new ImageAd >>>>>> { >>>>>> image = image, >>>>>> name = generatedAd.Image.FileName, >>>>>> displayUrl = Config.Get("DisplayURL"), >>>>>> url = generatedAd.Ad.Url >>>>>> }; >>>>>> >>>>>> var imageAdGroupAd = new AdGroupAd >>>>>> { >>>>>> ad = imageAd, >>>>>> adGroupId = (long)generatedAd.Ad.AdwordsAdGroupId, >>>>>> >>>>>> }; >>>>>> >>>>>> // prepare to add the new image ad to the ad words group >>>>>> var operation = new AdGroupAdOperation >>>>>> { >>>>>> @operator = Operator.ADD, >>>>>> operand = imageAdGroupAd >>>>>> }; >>>>>> >>>>>> operations.Add(operation); >>>>>> } >>>>>> >>>>>> try >>>>>> { >>>>>> >>>>>> ((AdGroupAdService)user.GetService(AdWordsService.v201406.AdGroupAdService)) >>>>>> .mutate(operations.ToArray()); >>>>>> } >>>>>> >>>>>> However, running this code now results in an exception being thrown. >>>>>> The main exception message is 'The underlying connection was closed: An >>>>>> unexpected error occurred on a send.', and the inner exception message >>>>>> is >>>>>> 'An existing connection was forcibly closed by the remote host.'. Have >>>>>> these errors come up before in AdWords? Is there a particular way to >>>>>> handle >>>>>> them? >>>>>> >>>>>> Thanks, >>>>>> Conor >>>>>> >>>>>> >>>>>> On Friday, 26 September 2014 21:01:48 UTC+1, Anash P. Oommen (AdWords >>>>>> API Team) wrote: >>>>>>> >>>>>>> Hi Conor, >>>>>>> >>>>>>> This is a code example from an old version of the client library. >>>>>>> Let me know if it works for you. >>>>>>> >>>>>>> // Create your image ad. ImageAd imageAd = new ImageAd(); >>>>>>> imageAd.name = "My Image Ad"; imageAd.displayUrl = >>>>>>> "www.example.com"; imageAd.url = "http://www.example.com >>>>>>> <https://www.google.com/url?q=http://www.example.com&usg=AFQjCNGH9WGZ0rgKFLCMkObqewQjm4Gotw>"; >>>>>>> // Load your image into data field. string imageUrl = >>>>>>> "https://sandbox.google.com/sandboximages/image.jpg >>>>>>> <https://www.google.com/url?q=https://sandbox.google.com/sandboximages/image.jpg&usg=AFQjCNFzC3A1uAlzhaOkqVoOs3fzZ0lmaw>"; >>>>>>> WebRequest request = HttpWebRequest.Create(imageUrl); >>>>>>> WebResponse response = request.GetResponse(); MemoryStream >>>>>>> memStream = new MemoryStream(); using (Stream responseStream = >>>>>>> response.GetResponseStream()) { byte[] strmBuffer = new >>>>>>> byte[4096]; int bytesRead = responseStream.Read(strmBuffer, 0, >>>>>>> 4096); while (bytesRead != 0) { >>>>>>> memStream.Write(strmBuffer, 0, bytesRead); bytesRead = >>>>>>> responseStream.Read(strmBuffer, 0, 4096); } } >>>>>>> imageAd.image = new Image(); imageAd.image.data = >>>>>>> memStream.ToArray(); // Set the AdGroup Id. AdGroupAd >>>>>>> imageAdGroupAd = new AdGroupAd(); imageAdGroupAd.adGroupId = >>>>>>> adGroupId; imageAdGroupAd.adGroupIdSpecified = true; >>>>>>> imageAdGroupAd.ad = imageAd; >>>>>>> >>>>>>> >>>>>>> Cheers, >>>>>>> Anash P. Oommen, >>>>>>> AdWords API Advisor. >>>>>>> >>>>>>> On Thursday, September 25, 2014 10:26:52 AM UTC-4, >>>>>>> testa...@geeks.ltd.uk wrote: >>>>>>>> >>>>>>>> HI Anash, >>>>>>>> >>>>>>>> Thanks for your help. I am slightly lost though as to how to create >>>>>>>> an ImageAd, from start to finish. So I upload the Image to AdWords, >>>>>>>> and get >>>>>>>> the media id of that image. Then what do I do with it? I'm looking at >>>>>>>> the >>>>>>>> API here >>>>>>>> https://developers.google.com/adwords/api/docs/reference/v201406/AdGroupAdService.ImageAd >>>>>>>> >>>>>>>> and can't see where I should put the id. I also don't know what the >>>>>>>> following steps are. >>>>>>>> >>>>>>>> I have downloaded the AdWords examples for C# but there are no >>>>>>>> references to ImageAd, so I can't see how it's done. >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Conor >>>>>>>> >>>>>>>> On Thursday, 25 September 2014 14:19:46 UTC+1, Anash P. Oommen >>>>>>>> (AdWords API Team) wrote: >>>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> To create an imageAd, you'd need to upload the image first using >>>>>>>>> MediaService (see >>>>>>>>> https://github.com/googleads/googleads-dotnet-lib/blob/master/examples/AdWords/CSharp/v201406/Miscellaneous/UploadImage.cs), >>>>>>>>> >>>>>>>>> then use that media id to create an image Ad. >>>>>>>>> >>>>>>>>> Cheers, >>>>>>>>> Anash P. Oommen, >>>>>>>>> AdWords API Advisor. >>>>>>>>> >>>>>>>>> On Thursday, September 25, 2014 7:21:24 AM UTC-4, >>>>>>>>> testa...@geeks.ltd.uk wrote: >>>>>>>>>> >>>>>>>>>> Hi All, >>>>>>>>>> >>>>>>>>>> I am trying to use the following code, in C#, to upload some >>>>>>>>>> ImageAds to AdWords; however, it appears that I am using the wrong >>>>>>>>>> service. >>>>>>>>>> However, using a MediaService forces me to change method from mutate >>>>>>>>>> to >>>>>>>>>> upload, the argument from List<AdGroupAdOperation> to Media[], and >>>>>>>>>> then I >>>>>>>>>> have to change the type from ImageAd to Image, otherwise I can't put >>>>>>>>>> it in >>>>>>>>>> the array, and then I can't assign certain information, such as >>>>>>>>>> AdGroupId, >>>>>>>>>> which I need to specify. >>>>>>>>>> >>>>>>>>>> Does anyone know where I'm going wrong or what I should be doing >>>>>>>>>> instead to achieve my goal of putting certain ImageAds in a certain >>>>>>>>>> AdGroup? >>>>>>>>>> >>>>>>>>>> Thanks, >>>>>>>>>> Conor >>>>>>>>>> >>>>>>>>>> ========================== Code ========================== >>>>>>>>>> var operations = new List<AdGroupAdOperation>(); >>>>>>>>>> >>>>>>>>>> foreach (var generatedAd in generatedAds) >>>>>>>>>> { >>>>>>>>>> // create a new image to put in the imageAd >>>>>>>>>> var image = new Image >>>>>>>>>> { >>>>>>>>>> data = generatedAd.Image.FileData, >>>>>>>>>> type = MediaMediaType.IMAGE >>>>>>>>>> }; >>>>>>>>>> >>>>>>>>>> // create a new image ad >>>>>>>>>> var imageAd = new ImageAd >>>>>>>>>> { >>>>>>>>>> image = image, >>>>>>>>>> displayUrl = DisplayURL, >>>>>>>>>> url = generatedAd.Ad.Url >>>>>>>>>> }; >>>>>>>>>> >>>>>>>>>> var imageAdGroupAd = new AdGroupAd >>>>>>>>>> { >>>>>>>>>> adGroupId = (long)generatedAd.Ad.AdwordsAdGroupId >>>>>>>>>> }; >>>>>>>>>> >>>>>>>>>> // prepare to add the new image ad to the ad words >>>>>>>>>> group >>>>>>>>>> var operation = new AdGroupAdOperation >>>>>>>>>> { >>>>>>>>>> @operator = Operator.ADD, >>>>>>>>>> operand = imageAdGroupAd >>>>>>>>>> }; >>>>>>>>>> >>>>>>>>>> operations.Add(operation); >>>>>>>>>> } >>>>>>>>>> >>>>>>>>>> try >>>>>>>>>> { >>>>>>>>>> >>>>>>>>>> ((AdGroupAdService)user.GetService(AdWordsService.v201406.AdGroupAdService)) >>>>>>>>>> .mutate(operations.ToArray()); >>>>>>>>>> } >>>>>>>>>> ========================== Code ========================== >>>>>>>>>> >>>>>>>>> -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and Google+: https://googleadsdeveloper.blogspot.com/ https://plus.google.com/+GoogleAdsDevelopers/posts =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/adwords-api. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/8f6e614c-091a-430b-b1d4-80428b41c6cd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.