Client in another domain

Hi,
My solution includes two projects,
one for the server side in net core and the other for the client side in Angular,
I implemented the server part on the server side and the client component on the client side.
I operate the two projects separately - in two separate domains and contact the service side by contacting http.
The server part works - I get a token from the OpenDocument function, but when I run the objImag.View() function in the client - I get an error that docImage.axd is not found. When I change the solution that both projects will run together on the same domain, it works.
Is it possible to use the component in such a way that the client and server are not in the same domain?

@rachelm,

Sadly, Doconut Viewer does not support the client on a different domain or subdomain. They must be together.

You can try using iframes to display the viewer on a different domain.

Let me know if you have other questions related to this topic.

ok,

Another question, I have a core project with Angular and I want to save the images in s3, with the function exportToCloud, for this I used startup - with UseDoconutCloud. The question is where to place the file:
Doconut-Cloud-Config.json, in the MVC project I put it in wwwroot/webfarm and it worked fine, but in the core project with Angular it doesn’t work like that.

@rachelm,

Using the sample Doconut Angular, we are able to upload to the cloud placing Doconut-Cloud-Config.json file in the wwwroot/webfarm folder.

Be sure you have at least these lines in the config file:

{
  "WebfarmPath": "C:\\Doconut.Angular\\wwwroot\\webfarm\\",
  "DoconutAwsS3BucketName": "",
  "DoconutAwsS3Key": "",
  "DoconutAwsS3Secret": "",
  "DoconutAwsS3RegionEndpoint": ""
}

Can you give the complete error you are getting, please?

I created a core project that doesn’t have Angular and doesn’t have a wwwroot folder, then I added Angular in a slightly different way than the example, the problem is that I added a wwwroot\webfarm folder with the Doconut-CloudConfig.json file and it doesn’t help, I get an error:

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

second alert:
Init error or Invalid Token. The document might be closed. Current path is: /DocImage.axd//DocImage.axd/DocImage.axd

error -
System.ArgumentNullException: Value cannot be null. (Parameter ‘path’) at System.IO.Directory.CreateDirectory(String path) at Doconut.Cloud.BaseImageHandler. .MoveNext()— End of stack trace from previous location — at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

The question is how does the component know the location of the Doconut-CloudConfig.json file? Is it possible to set the location? You wrote to me to define this in the file itself in the WebfarmPath property, but for me it probably doesn’t reach the file at all.

@rachelm,

I would like to know what FrontEnd are you using. wwwroot is not just for Angular, it’s the default folder for your root folder.

What type of .NET Core did you create for your Doconut project?

Can you try to replace wwwroot for your root folder?

ASP.NET core web api

@rachelm,

I have created this sample project for you. Here I customized where the Doconut-Cloud-Config.json file is supposed to be.

I also noticed that the filename of the JSON file was incorrect. It was missing a “-” in between Cloud and Config.

Please check the Startup.cs file to see the custom folder for the Doconut-Cloud-Config.json file. In the HomeController.cs, you need to set up the AmazonConfig object with your information.

Hopefully, this sample will help you.

AngularNetCoreRachel.zip (1.8 MB)

Following on from the first question, if I define that both projects will be in the same domain, that means if there is a request to the server I will define a redirect to the same domain, is this possible?

@rachelm,

Excuse me, but I don’t quite understand the question. Is there a problem with the viewer when having the two projects under the same domain?

It would be very helpful if you could explain the complete workflow of the requests or attach a simple test example with the two projects. This way, I will be able to know if the problem you describe is related to the Doconut viewer.