When hosted under subfolder (both under IIS and Kestrel), stuck at homepage spinner
martinussuherman opened this issue · 6 comments
Steps to reproduce:
- Clone this repo
- Add these lines on Startup.cs
// Add these 2 lines
string basePath = Configuration.GetValue<string>("BasePath");
app.UsePathBase(basePath);
app.UseHttpsRedirection();
app.UseStaticFiles();
- Add this line on appsettings.json
"BasePath": "/BlazorSamples"
- Run the solution (dotnet run)
- Open browser, go to: http://localhost:5000/BlazorSamples
Expected result:
Samples homepage loaded succesfully.
Result:
Samples homepage stuck (only display loading spinner)
Is there anything missing that I need to add/configure to enable this scenario? Thank you in advance.
Update:
Found this error on the dotnet run console:
warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
Unhandled exception rendering component: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at blazor_samples.Shared.NavMenuComponent.OnAfterRender(Boolean firstRender) in E:\Data\Projects\blazor-samples\Shared\LeftPane\NavMenuComponent.razor:line 227
at Microsoft.AspNetCore.Components.ComponentBase.Microsoft.AspNetCore.Components.IHandleAfterRender.OnAfterRenderAsync()
at Microsoft.AspNetCore.Components.Rendering.ComponentState.NotifyRenderCompletedAsync()
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
Unhandled exception in circuit '25muYco2xjNF-Vp5A1xhGnUq-ZGzOOxfDk50KaefUjY'.
System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.)
---> System.NullReferenceException: Object reference not set to an instance of an object.
at blazor_samples.Shared.NavMenuComponent.OnAfterRender(Boolean firstRender) in E:\Data\Projects\blazor-samples\Shared\LeftPane\NavMenuComponent.razor:line 227
at Microsoft.AspNetCore.Components.ComponentBase.Microsoft.AspNetCore.Components.IHandleAfterRender.OnAfterRenderAsync()
at Microsoft.AspNetCore.Components.Rendering.ComponentState.NotifyRenderCompletedAsync()
--- End of inner exception stack trace ---
Thanks for your interest in Syncfusion.
We have checked with your reported issue in Sub folder hosting navigation. We suspect that you missed to add the '/' in end of the URL in your browser. So, could you please add '/' in you browser URl like 'http://localhost:5000/BlazorSamples/' and ensure it again?
Please let us know if you have any concerns.
Regards,
Muthukumar K
Hi @kmuthukumar23, I've tried your suggestion, and it does works when using Kestrel, but unfortunately when hosted under IIS your workaround didn't work.
Regards,
Martinus
Thanks for your update.
We will check this with IIS and update you shortly.
Regards,
Muthukumar K
Thanks for your patience
We have checked your reported issue. Unfortunately, we are unable to reproduce the reported issue at our end. Its works well also in IIS by adding the '/' end slash. For your convenience, we have created the sample and hosted them in IIS. Also, we have recorded the video for your reference.
Refer to the below link,
https://www.syncfusion.com/downloads/support/directtrac/general/7z/Recording-I307855-1288554205
For your convenience, we are sharing the publishing method which we follow on our end. Please refer to the below steps.
- install the Latest .NET Core hosting bundle on your machine.
- Open IIS and right-click on Sites -> Add Web Site, a dialog will open.
- Set sitename, hostname as your choice and then set physical path, it's your published folder location, and then click Ok button.
- Click the “Application Pools” from the left pane and double click your website, an edit dialog will open.
- Set the .NET CLR version as “No Managed Code” and then Click Ok.
- Run the application.
After referring to the sample if you are still facing the issue, please get back to us with the below details.
- Share the browser version details
- Visual Studio version
- .NET SDK version details
- Publish settings
Please get back to us with the requested details which will help us to resolve the reported issue as early as possible.
Regards,
Muthukumar K
Hi @kmuthukumar23, thanks for your info. I'll try again, following the steps you give.
We are closing this issue since there has been no recent activity. Feel free to reopen the issue and update your comments for the reinvestigation.