Asp.net core Blazor:System.NotSupportedException:找不到编码1252数据
我正在尝试使用单击按钮创建工作簿,但在尝试实例化工作簿时立即遇到错误:Asp.net core Blazor:System.NotSupportedException:找不到编码1252数据,asp.net-core,.net-core,blazor,Asp.net Core,.net Core,Blazor,我正在尝试使用单击按钮创建工作簿,但在尝试实例化工作簿时立即遇到错误: Blazor is running in dev mode without IL stripping. To make the bundle size significantly smaller, publish the application or see https://go.microsoft.com/fwlink/?linkid=870414 blazor.webassembly.js:1 WASM: Hello
Blazor is running in dev mode without IL stripping. To make the bundle size significantly smaller, publish the application or see https://go.microsoft.com/fwlink/?linkid=870414
blazor.webassembly.js:1 WASM: Hello from C#
blazor.webassembly.js:1 WASM:
blazor.webassembly.js:1 WASM: Unhandled Exception:
d.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM: System.NotSupportedException: Encoding 1252 data could not be found. Make sure you have correct international codeset assembly installed and enabled.
d.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM: at System.Text.Encoding.GetEncoding (System.Int32 codepage) <0x3538bc0 + 0x00316> in <d9c16b0fee7344919775df5988c885d0>:0
Startup.cs
如您所见,我正在尝试使用System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance)添加代码页代码>在startup.cs
中,但显然它们没有被加载。我做错了什么
参考资料:恐怕Aspose.Cell现在不支持asp.net core或core 3.0 blazor项目。您可以向产品支持论坛确认。请参阅
<button class="btn btn-primary" @onclick="DownloadFile">Download</button>
@code {
WeatherForecast[] forecasts;
protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetJsonAsync<WeatherForecast[]>("sample-data/weather.json");
}
private async void DownloadFile()
{
Console.WriteLine("Hello from C#");
var wb = new Aspose.Cells.Workbook();
Console.WriteLine("Created Workbook");
MemoryStream ms = new MemoryStream();
wb.Save(ms, Aspose.Cells.SaveFormat.Xlsx);
byte[] bytes = new byte[ms.Length];
ms.Read(bytes, 0, bytes.Length);
Console.WriteLine("Buffed Bytes, sending...");
await JS.InvokeVoidAsync("saveAsFile", "testWorkbook2.xlsx", bytes);
}
}
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
}
public void Configure(IComponentsApplicationBuilder app)
{
app.AddComponent<App>("app");
}
}
λ dotnet --version
3.0.100-preview9-014004