Please contact your support team if you have a question or need assistance for any Rackspace products, services, or articles.
This question is answered.
I'm having issues trying to create files using the openstack.net API. Below is the code I'm using:
CloudIdentity id = new CloudIdentity();id.Username = "myusername";id.APIKey = "myapikey";
CloudFilesProvider cfp = new CloudFilesProvider(id);string sPath = @"C:\test.jpg";
cfp.CreateObjectFromFile("test", sPath, "test.jpg");
I am able to create containers and list those containers but every time I try to upload a file I get the error "The item was not found or does not exist." The file definitely does exist on my local machine at the correct path and a container named "test" does exist already in my CloudFiles account and is listed when I call the ListContainers method.
I've also tried using the CreateObject method with a stream and get the same error.
I've looked at all the examples and they seem pretty straightforward so I'm not sure what I could be doing wrong. Any help would be greatly appreciated.
Since you did not specify a region in the CloudFilesProvider constructor, the provider is using the default region for your account. The default region may or may not match the region where you created the expected container. You should explicitly specify the region when creating the provider to match the region you are trying to upload your file to.
While I still am unclear how to use the constructor that includes the region for the CloudFilesProvider, it did lead me to discover that the CreateObjectFromFile method actually has a version that allows you to specify the region. Using that version of the method and specifying the correct region solved my problem.
Thank you for your help and for leading me in the right direction!
You are correct that I'm not specifying the region in the CloudFilesProvider constructor. I'm not sure how to do that. I do see there is a constructor that allows me to specify the region, but it then also requires two more parameters and IdentityProvider and an iRestService. I have no idea what those would be since I haven't seen them used in any examples.
The Rackspace Community (“Community”) is provided “AS IS” without warranty of any kind. The information on the Community sites is created by members of the Community and is intended for reference and general discussions only. Although some of the content may contain information provided by Rackspace employees, it does not represent an assessment of a particular customer environment or an assessment of any specific compliance with laws or regulations or constitute advice. We recommend that you engage additional expertise in order to further evaluate applicable requirements for your specific environment. For customer specific support issues please contact your Rackspace Support Team.READ MORE
RACKSPACE MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, AS TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THE RACKSPACE OPEN CLOUD COMMUNITY SITE. RACKSPACE RESERVES THE RIGHT TO DISCONTINUE OR MAKE CHANGES TO ITS SERVICES OFFERINGS AND SPECIFICATIONS AT ANY TIME WITHOUT NOTICE. USERS MUST TAKE FULL RESPONSIBILITY FOR APPLICATION OF ANY SERVICES AND/OR PROCESSES MENTIONED IN ANY COMMUNITY DISCUSSIONS. EXCEPT AS SET FORTH IN RACKSPACE GENERAL TERMS AND CONDITIONS, CLOUD TERMS OF SERVICE AND/OR OTHER AGREEMENT YOU SIGN WITH RACKSPACE, RACKSPACE ASSUMES NO LIABILITY WHATSOEVER, AND DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO ITS SERVICES INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
ALTHOUGH PART OF THE COMMUNITY GENERATED CONTENT MAY EXPLAIN HOW RACKSPACE SERVICES MAY WORK WITH THIRD PARTY PRODUCTS, THE INFORMATION CONTAINED IN THE COMMUNITY DISCUSSIONS IS NOT DESIGNED TO WORK WITH ALL SCENARIOS. ANY USE OR CHANGES TO THIRD PARTY PRODUCTS AND/OR CONFIGURATIONS SHOULD BE MADE AT THE DISCRETION OF YOUR ADMINISTRATORS AND SUBJECT TO THE APPLICABLE TERMS AND CONDITIONS OF SUCH THIRD PARTY. EVEN THOUGH RACKSPACE EMPLOYEES MAY PARTICIPATE IN THE COMMUNITY DISCUSSIONS, RACKSPACE DOES NOT PROVIDE TECHNICAL SUPPORT FOR THIRD PARTY PRODUCTS, OTHER THAN SPECIFIED IN YOUR HOSTING SERVICES AGREEMENT YOU HAVE SIGNED WITH RACKSPACE AND RACKSPACE ACCEPTS NO RESPONSIBILITY FOR THIRD-PARTY PRODUCTS.READ LESS