MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

AmazonS3FileSystemContentProvider: Delete file issue   (Mono Support )

Viewed 16673 time(s), 6 post(s) 18.05.2015 13:15:16by nasman
nasman

nasman

18.05.2015 13:15:16
Hi 
I am testing the AmazonS3FileSystemContentProvider.  StoreFile and GetFile methods are working fine.  There is an issue with the DeleteFile method. I am getting a following error message when I call the DeleteFile Method. I think there is an issue with the threesharp library. Its translating the bucket URL differently. It should use https://BucketName.s3.amazonaws.com/Upload/user/john/user-drive/vP27ROWJm06cceX7bSwyYw-Blank_CV.docx  instead of  https://s3.amazonaws.com/BucketName/Upload/user/john/user-drive/vP27ROWJm06cceX7bSwyYw-Blank_CV.docx. Can you please check for me?

Many Thanks




Fiddler Request: 

DELETE https://s3.amazonaws.com/BucketName/Upload/user/john/user-drive/vP27ROWJm06cceX7bSwyYw-Blank_CV.docx HTTP/1.1
User-Agent: Amazon S3 CSharp Library
x-amz-date: Mon, 18 May 2015 13:09:41 GMT
Authorization: AWS AKIAJ7U7V6XTOHJXZ7WA:+LdN46Z8sdfdsi5hB234unpLIfRl6aBs=
Host: s3.amazonaws.com
Content-Length: 0


Fiddler Response: 

HTTP/1.1 301 Moved Permanently
x-amz-request-id: 1F980978AB724F96
x-amz-id-2: GJTbdz+kWXnspwGvkx5MiOi3Wr79PwhAGGH1B5OpKybJI7/f7Fz4ECIfnZ3+YzDmvGZsXTeLXEM=
Content-Type: application/xml
Transfer-Encoding: chunked
Date: Mon, 18 May 2015 13:09:42 GMT
Server: AmazonS3

1bd
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>PermanentRedirect</Code><Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message><Bucket>BucketName</Bucket><Endpoint>BucketName.s3.amazonaws.com</Endpoint><RequestId>1F980978AB724F96</RequestId><HostId>GJTbdz+kWXnspwGvkx5MiOi3Wr79PwhAGGH1B5OpKybJI7/f7Fz4ECIfnZ3+YzDmvGZsXTeLXEM=</HostId></Error>
0

 
Dieser Inhalt wurde noch nicht bewertet. 
845 Reputation 93 Total posts
idrazic

idrazic

18.05.2015 15:01:57
Hi nasman,

Do you have "urlFormat" specified in web.config?
<add name="AmazonS3FileSystemContentProvider" type="MonoSoftware.MonoX.FileSystem.AmazonS3FileSystemContentProvider, MonoX" bucketLocation="us" accessKeyId="xxxxxxxxx" secretAccessKey="xxxxxxxxxx" urlFormat="{0}.s3.amazonaws.com" />

MonoX version?

Regards,
Igor
Dieser Inhalt wurde noch nicht bewertet. 
1384 Reputation 152 Total posts
nasman

nasman

18.05.2015 15:38:25
HIi idrazic,

All the AmazonS3FileSystemContentProvider settings are fine that's why StoreFile is working. We have purchased the source code and done some customisation but didn't change anything in the  FileSystemContentProviders .  Monox version is 4.7.40.3493.   

Thanks

Dieser Inhalt wurde noch nicht bewertet. 
845 Reputation 93 Total posts
idrazic

idrazic

19.05.2015 08:00:49
It looks like our AmazonS3FileSystemContentProvider will need an update.
My assumption is that ThreeSharpWrapper uses a calling format that is not supported any more.
I haven't tested this yet, but it looks like all methods that user ThreeSharpWrapper will need to be modified to use Object[Add|Copy|Delete]Request 
Can you test if it will work with this code (replace):

private string DeleteObject(string path)
{
    try
    {
        using (ObjectDeleteRequest request = new ObjectDeleteRequest(GetBucketNameFromPath(path), GetEncodedPath(path)))
        {
            using (ObjectDeleteResponse response = this.service.ObjectDelete(request))
            {
                return response.StatusCode == System.Net.HttpStatusCode.OK ? string.Empty :
                    response.StreamResponseToString();
            }
        }
    }
    catch (Exception ex)
    {
        return ex.Message;
    }
}
Dieser Inhalt wurde noch nicht bewertet. 
1384 Reputation 152 Total posts
nasman

nasman

19.05.2015 08:38:37
 Yes, It's working. I have checked the ThreeSharp library page(http://threesharp.codeplex.com/). They are recommending that we should  use AWS SDK instead of the ThreeSharp library. They are no longer maintaining the ThreeSharp library.  Is it possible for you that you can update AmazonS3FileSystemContentProvider using AWS SDK? 
 

Many Thanks
Dieser Inhalt wurde noch nicht bewertet. 
845 Reputation 93 Total posts
idrazic

idrazic

19.05.2015 09:42:28
Thank you for testing.

Provider will certainly need to be updated to overcome the endpoint issues.
I don't know if we will upgrade to AWS SDK right away.

Regards,
Igor
Dieser Inhalt wurde noch nicht bewertet. 
1384 Reputation 152 Total posts