ASPNETCORE_ENVIRONMENT prevent syncfusion module loading


Hi,

please ignore the Control "Accordion".

the question indifferent to Controls.

It seems that the ASPNETCORE_ENVIRONMENT env var has something to do with syncfusion blazor module loading.

Once a changed it from "Development" to "MyEnvrionment", this error occurs:



Microsoft.Hosting.Lifetime: Information: Now listening on: https://localhost:5001
Microsoft.Hosting.Lifetime: Information: Now listening on: http://localhost:5000
Microsoft.Hosting.Lifetime: Information: Application started. Press Ctrl+C to shut down.
Microsoft.Hosting.Lifetime: Information: Hosting environment: MyEnvironment
Microsoft.Hosting.Lifetime: Information: Content root path: D:\repo\Sample-Enum-Dropdown\WebApplication1
Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer: Warning: Unhandled exception rendering component: Failed to fetch dynamically imported module: https://localhost:5001/_content/Syncfusion.Blazor/scripts/syncfusion-blazor-6e1741.min.js
TypeError: Failed to fetch dynamically imported module: https://localhost:5001/_content/Syncfusion.Blazor/scripts/syncfusion-blazor-6e1741.min.js

Microsoft.JSInterop.JSException: Failed to fetch dynamically imported module: https://localhost:5001/_content/Syncfusion.Blazor/scripts/syncfusion-blazor-6e1741.min.js
TypeError: Failed to fetch dynamically imported module: https://localhost:5001/_content/Syncfusion.Blazor/scripts/syncfusion-blazor-6e1741.min.js
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
at Syncfusion.Blazor.Internal.SfBaseUtils.ImportModule(IJSRuntime jsRuntime, SfScriptModules scriptModule, String hashKey)
at Syncfusion.Blazor.SfBaseComponent.OnAfterRenderAsync(Boolean firstRender)
at Syncfusion.Blazor.SfDataBoundComponent.OnAfterRenderAsync(Boolean firstRender)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'DkMKaoQyC7_lOQ0O-2fN4meBIuJL60V4o9OenYgRytY'.

Microsoft.JSInterop.JSException: Failed to fetch dynamically imported module: https://localhost:5001/_content/Syncfusion.Blazor/scripts/syncfusion-blazor-6e1741.min.js
TypeError: Failed to fetch dynamically imported module: https://localhost:5001/_content/Syncfusion.Blazor/scripts/syncfusion-blazor-6e1741.min.js
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
at Syncfusion.Blazor.Internal.SfBaseUtils.ImportModule(IJSRuntime jsRuntime, SfScriptModules scriptModule, String hashKey)
at Syncfusion.Blazor.SfBaseComponent.OnAfterRenderAsync(Boolean firstRender)
at Syncfusion.Blazor.SfDataBoundComponent.OnAfterRenderAsync(Boolean firstRender)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
Microsoft.Hosting.Lifetime: Information: Application is shutting down...


Can you please suggest?

Thanks,

Yi



Attachment: ASPNETCORE_ENVIRONMENT_a8283ff5.7z

4 Replies

KS Karthigai Selvi Ponmalai Syncfusion Team May 9, 2022 12:14 PM UTC

Hi Yi,

Thank you for contacting Syncfusion Support.


We have validated your reported issue.  Static web assets are only enabled by default in the Development environment. If you are using a custom environment, you need to call UseStaticWebAssets() in IHostBuilder to enable them explicitly.

please add the below code snippet in your program.cs file to resolve the reported issue,

 

public static IHostBuilder CreateHostBuilder(string[] args) =>

            Host.CreateDefaultBuilder(args)

                .ConfigureWebHostDefaults(webBuilder =>

                {

                    webBuilder.UseStaticWebAssets();

                    webBuilder.UseStartup<Startup>();

                });

 


For your reference, I have attached the Microsoft documentation,

https://docs.microsoft.com/th-th/aspnet/core/razor-pages/ui-class?view=aspnetcore-3.1&tabs=visual-studio#consume-content-from-a-referenced-rcl

If you need any further assistance, please get back to us.

Regards,
Karthigai Selvi P



YH Yi Han May 10, 2022 07:02 AM UTC

Hi  Karthigai,


Thank you for your reply! Problem 

Yi



JL Joshna Lingala Uthama Reddy Lingala Syncfusion Team May 12, 2022 03:57 PM UTC

Hi Yi,


Welcome…!


We are happy that the issue is resolved.


Please get back to us if you need further assistance.


Regards,

Joshna L



MC Mike Chafin December 15, 2022 01:57 PM UTC

Run into this issue and this fixed it.


Thanks!


Loader.
Up arrow icon