I've created a component for reading Excel files that works fine in a blank Blazor project, but when I add it to a Blazor project based on ABP Framework, I get an error message saying 'Invocation provides 4 argument(s) but target expects 3.' Could you please help me understand why this happens and how to fix it? Thank you!"
The following is my code.
@page "/upload-excel"
@using System.IO
<Field>
<FileEdit Changed="@OnChanged" />
</Field>
@code {
async Task OnChanged(FileChangedEventArgs e)
{
try
{
var file = e.Files.FirstOrDefault();
if (file == null)
{
return;
}
using (MemoryStream result = new MemoryStream())
{
await file.OpenReadStream(long.MaxValue).CopyToAsync(result);
}
} catch (Exception exc)
{
Console.WriteLine(exc.Message);
} finally
{
this.StateHasChanged();
}
}
}
- ABP Framework version: v7.1.0
- UI type: Blazor
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): no
- Exception message and stack trace:System.IO.InvalidDataException HResult=0x80131501 Message=Invocation provides 4 argument(s) but target expects 3. Source=Microsoft.AspNetCore.Components.Server StackTrace: 在 Microsoft.AspNetCore.SignalR.Protocol.MessagePackHubProtocolWorker.BindArguments(MessagePackReader& reader, IReadOnlyList`1 parameterTypes)
- Steps to reproduce the issue:"open the page
23 Answer(s)
-
0
hi
Set EnableDetailedErrors in AddHubOptionsto see detail errors.builder.Services.AddSignalR(hubOptions => { hubOptions.EnableDetailedErrors = true; });Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
hi
Set EnableDetailedErrors in AddHubOptionsto see detail errors.builder.Services.AddSignalR(hubOptions => { hubOptions.EnableDetailedErrors = true; });I set this in the program. cs of Blazor. Server. Host, but it is still the same error. Where can I go to see the detailed information?
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Can you share a template project that reproduces the problem?
I have sent you an email with a template project attachment, please check it.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
-
0
Some source files of your project are broken. Please fix it and share again(run
abp cleanand remove thenode_moduels). ThanksSorry, my project has been encrypted by company software. In fact, this is just an empty ABP module project. You can create one locally and then copy the file "ReadExcel. razor" to open it, which can reproduce the error.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
The code for ReadExcel. razor is as follows:
@page "/upload-excel" @using System.IO `<Field> <FileEdit Changed="@OnChanged" /> </Field>` @code { async Task OnChanged(FileChangedEventArgs e) { try { var file = e.Files.FirstOrDefault(); if (file == null) { return; } using (MemoryStream result = new MemoryStream()) { await file.OpenReadStream(long.MaxValue).CopyToAsync(result); } } catch (Exception exc) { Console.WriteLine(exc.Message); } finally { this.StateHasChanged(); } } }This is just a simple function of selecting a local Excel file and reading it.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
hi
I think there is a problem with Blazorise. You can use the asp net core way to upload the files.
https://learn.microsoft.com/en-us/aspnet/core/blazor/file-uploads?view=aspnetcore-7.0&pivots=server
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
hi
I think there is a problem with Blazorise. You can use the asp net core way to upload the files.
https://learn.microsoft.com/en-us/aspnet/core/blazor/file-uploads?view=aspnetcore-7.0&pivots=server
I have tried this method and the same error occurred.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
hi
Can you test the code in an opensource template project and share it again?
abp new BookStore -t moduleThe new project has been sent to you.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
I have not received it yet.
liming.ma@volosoft.com
The email has been returned, and the attachment is only 50M in size. Prompt error:the mta server of volosoft.com -- aspmx.l.google.com(142.250.157.26) reply:552 5.2.3 Your message exceeded Google's message size limits. Please visit https://support.google.com/mail/?p=MaxSizeError to view our size guidelines. l192-20020a6391c9000000b005347ef6ec11si198010pge.760 - gsmtp at 2023-05-31 11:48:50
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
-
0
Successfully sent
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
-
0Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
-
0Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)







