Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "KarakTheWise"

Well, what solved it for me was adding this line to my scripts in package.json:

"build-serve": "node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve",

To run the project I use npm run build-serve

I also was advised to by ASP-Zero support to remove 'gulp buildDev' from the start script:

"<span class="colour" style="color: rgb(34, 34, 34);">Then, just run "</span>npm run create-dynamic-bundles<span class="colour" style="color: rgb(34, 34, 34);">" once... You only need to run "</span>npm run create-dynamic-bundles<span class="colour" style="color: rgb(34, 34, 34);">" if you make any changes in the files which is used in bundles.json."</span>

<span class="colour" style="color: rgb(34, 34, 34);">That alone did not solve problem since the root of the problem was this error:</span>

<span class="colour" style="color: rgb(34, 34, 34);">FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory</span>

Thus the need add the 'build-serve' section to the scripts.

<span class="colour" style="color: rgb(34, 34, 34);">Here's my current scripts section from package.json:</span>

"scripts": { "ng": "ng", "publish": "gulp build && ng build --prod", "start": "ng serve --host 0.0.0.0 --port 4200", "hmr": "gulp buildDev && ng serve --host 0.0.0.0 --port 4200 --hmr", "test": "gulp buildDev && ng test", "pree2e": "webdriver-manager update --standalone false --gecko false", "e2e": "gulp buildDev && protractor", "create-dynamic-bundles": "gulp buildDev", "build-serve": "node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve", "nswag": "cd nswag/ && refresh.bat" },

I hope that helps your issue!

Excellent! Thank you. I'll take a look at it now.

Thank you! It has been sent.

Thank you! I've looked into that library and may try it out. Thanks for all the help!

Update: I was successful in using the function call as described in the Stack forum:

guestDocumentURL() { return this._sanitizer.bypassSecurityTrustResourceUrl('data:application/pdf;base64' + this.guestDocument); }

<iframe id="documentIframe" [src]="guestDocumentURL()" style="width: 1056px; height:800px"></iframe>

Thanks for the help and the Stack link. I'm out of town for the holiday weekend but will check it out first of next week.

As I'm looking at this, I'm wondering is there a better way to do this and not use the iframe? The reason behind the iframe was that I could bind the string to the src property:

<iframe id="documentIframe" [src]="guestDocument" style="width: 1056px; height:800px"></iframe>

I wasn't sure how else to diplay the it otherwise.

Thank you for the response. Here what I'm returning, which to me looks like it should be a base64 string:

Dto:

public class GetGuestDocumentOutputDto { public string GuestDocument { get; set; }

public GetGuestDocumentOutputDto(string guestDocument) { GuestDocument = guestDocument; }

}

This is the method in the app service that's called in Angular:

public async Task GetGuestDocument(Guid documentId) { var guestDocument = await _binaryFileUploadManager.GetBinaryFileOrNullAsync(documentId);

`var guestDoc = Convert.ToBase64String(guestDocument.Bytes);

return new GetGuestDocumentOutputDto(guestDoc);`

}

Am I missing something? If the string property of the Dto is set by Convert.ToBase64String, shouldn't it be a base64 string?

Hi,

Just wanted say thank for all the help. I think I'm far enough along that I can close the ticket. Right now I have a find a solution for displaying the a PDF from a byte array. There's quite a bit on Stack and other places where I'm sure I can find a solution in the next few days. Thanks again for the guidance to get to this point!

UPDATE: I was able to get everything into the byte array and into the database. My next process is now getting the byte array out of the database and back into a loadable PDF document.

Thank you for the help! Yes, I was able to get that far yesterday. I ended up making a ControllerBase because I wasn't sure if that was needed. Then I made a GuestEventController that inherits from the base.:

public class GuestEventController : GuestEventControllerBase { public GuestEventController( ITempFileCacheManager tempFileCacheManager, IBinaryFileUploadManager binaryFileUploadManager, IGuestEventAppService guestEventAppService) : base(tempFileCacheManager, binaryFileUploadManager, guestEventAppService) { } }

In my Angular .ts file I was able to get this to work and it is being sent to the controller. this.uploader = new FileUploader({ url: AppConsts.remoteServiceBaseUrl + '/GuestEvent/UploadGuestDocument' }); `` May main issue now is that I'm trying to get a PDF, not an image inserted as a binary object into the database. All the code I've been able to find so far online is wanting a literal file location because all the examples are using this to get the file: System.IO.FileStream fileStream = new System.IO.FileStream(input.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);

The issue is that the file is not found on \...\ASPNET-Zero\Resolution\aspnet-core\src\Resolution.Web.Host\GuestContractTest_05.pdf' . I am needing to deal with it virtually as a passed object like you do with the image. I don't know if I'm makging sense?

This is what I have right now but again, it is expecing a physical path:

var contractFile = _tempFileCacheManager.GetFile(input.FileToken); System.IO.FileStream fileStream = new System.IO.FileStream(input.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read); System.IO.BinaryReader binaryReader = new System.IO.BinaryReader(fileStream); long byteLength = new System.IO.FileInfo(input.FileToken).Length; contractFile = binaryReader.ReadBytes((Int32)byteLength); fileStream.Close(); fileStream.Dispose(); binaryReader.Close(); return new UploadGuestDocumentOutputDto { FileToken = input.FileToken, Name = input.FileName, FileType = input.FileType, Bytes = contractFile }; ``That's where I'm at right now. If I just knew the correct 'thread to pull' as it were, I think I'd be on my way. Thanks again for the help and any advice is most welcome!

Ok, I think I found some of my issues. Do I need to make a controller like the ProfileControllerBase to use like you did?:

this.uploader = new FileUploader({ url: AppConsts.remoteServiceBaseUrl + '/Profile/UploadProfilePicture' });

It took me a bit to find since I was presuming it was an api service.

I tried puttung /api/services/app/GuestEvent/UploadGuestContract and I'm getting a 415 error. If I just use this.uploader = new FileUploader({ url: AppConsts.remoteServiceBaseUrl + '/GuestEvent/UploadGuestContract' }); I get a 404.

I notice the updateProfilePicture() funciton is a call to the api service Profile. this._profileService.updateProfilePicture(input) I guess I'm not sure how the two play nicely together :)

I've been working through the binary object upload process and have been using the Angular component change-profile-picture-modal as my starting point. There are a couple points where I'm not following the code:

1.) initFileUploader() calls the upload process but appears to be called on show() when the modal is opened. I'm a bit lost on how this works due to the fact I haven't yet selected and file at this point. I see that it works but not how.

2.) The save() function calls this.uploaded.uploadAll() if useGravatarProfilePicture is false. I am unable to find any documentation as to how uploadAll() actually does.

Any advise and direction would be most helpful. Thank you once again!

Showing 21 to 30 of 43 entries