Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

BinaryObjectManager cant response #4103


User avatar
0
mamak created

Hi, I have a simple service method that getting binary obejcts from db.

public async Task<BinaryObject> GetBinaryObj(Guid Id) { BinaryObject binObj = await _binaryObjectManager.GetOrNullAsync(Id); return binObj; }

but when i call this service from chrome its response is nothing.

But In ProfileController :

private async Task<FileResult> GetProfilePictureById(Guid profilePictureId) { var file = await _binaryObjectManager.GetOrNullAsync(profilePictureId); if (file == null) { return GetDefaultProfilePicture(); }

        return File(file.Bytes, MimeTypeNames.ImageJpeg);
    }

this code works fine. But when i want to make it a service in application layer, there is no response.


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @mamak,

    You should not return an entity to client via an app service. IF you look at your log file, probably there is an exception about it.

    If you want to send a binary object to client, you can send it to client as base64 string or byte array. You can check ProfileAppService to see it's usage <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/master/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Application/Authorization/Users/Profile/ProfileAppService.cs">https://github.com/aspnetzero/aspnet-ze ... Service.cs</a>.