Core cloud questions

Hi
I have several questions:

  1. Is presentation in iframe will work for same subdomain with professional license?

  2. In file startup.cs, when I use appBranch.UseDoconutCloud(cloudOptions), while cloudOptions correctly configured with AWS S3 bucket, I receive following errors:

Init error. Please make sure your Startup.cs has the Doconut middleware declared. Handler is: /DocImage.axd

Return: undefined. Error: Cannot read properties of undefined (reading ‘length’)

When I replace appBranch.UseDoconutCloud(cloudOptions) with appBranch.UseDoconut(new DoconutOptions { ShowDoconutInfo = true, UnSafeMode = false }), it works correctly. Why it happens?

  1. When I run Cloud.Core example still original file saved locally, why it’s needed, can I disable local file save?

Thanks,

@radib,

EDITED…
Look at the last post.

Thanks Gabriel, but it will work on different subdomains for example: a.cat.com and b.cat.com?

@radib,

Regarding the second question, I was able to replicate the error. This was due to missing attributes in the Doconut-Cloud-Config.json file. In order to fix this issue, you must add these variables:

  "DoconutAwsS3BucketName": "",
  "DoconutAwsS3Key": "",
  "DoconutAwsS3Secret": "",
  "DoconutAwsS3RegionEndpoint": ""

The file needs to be in the following folder:

   \wwwroot\webfarm\

In case you need to know the basic structure of the file, here is a sample:

{
  "DoconutCdnUrl": "",
  "FunctionsConfig": {
    "CachePages": false,
    "CacheInMemory": false,
    "CacheTimeMinutes": 60,
    "Search": false,
    "Annotation": false,
    "RotateFlip": false,
    "Links": false,
    "Watermark": false,
    "Hide": false
  },
  "Location": 5,
  "Token": "",
  "DefaultConfigFallBack": true,
  "SaveConfigToDisk": true,
  "SaveConfigToCache": false,
  "PerDocumentFunctions": false,
  "LogErrors": false,
  "ConfigCacheTimeMinutes": 60,
  "TokenPath": "/",
  "WebfarmPath": "C:\\Core.Cloud\\wwwroot\\webfarm\\",
  "DoconutAwsS3BucketName": "",
  "DoconutAwsS3Key": "",
  "DoconutAwsS3Secret": "",
  "DoconutAwsS3RegionEndpoint": ""
}

Regarding your third question, you can always use streams in memory instead of saving them to disk. For example, you can use the following method from the IFormFile control:

   var stream = file.OpenReadStream();
   var fileInfo = new FileInfo(file.FileName);

Then, you can use the stream and fileInfo as parameters for the OpenDocument method:

   string token = docViewer.OpenDocument(streamFile, fileInfo);

With this code, the file will not be written to your local disk, and it will be saved directly into the cloud.


Now, regarding the iframes, they used to work several years ago. However, that has changed. It does not matter if they are in the same domain; the restrictions do not allow them to work.

Let me know if you have any other related questions.

1 Like

Thanks a lot Gabriel! :grinning:

1 Like

@radib,

Regarding your first question about the iframe issue, I researched again and it’s possible to load an iframe between different subdomains with a professional license.

To allow this, you need to run in an unsafe mode and use the following configuration in your web.config file:

<appSettings>
    <add key="DoconutUnSafeMode" value="true"/>
</appSettings>
1 Like