Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

takes too long to open #7

Closed
LeiYangGH opened this issue Dec 7, 2020 · 5 comments
Closed

takes too long to open #7

LeiYangGH opened this issue Dec 7, 2020 · 5 comments

Comments

@LeiYangGH
Copy link

LeiYangGH commented Dec 7, 2020

Hi,

I like the web site and i'm trying to understand it. I know C# well but not asp.net.
I've deployed the website on my personal server, you can have a try:

http://leiyang.icu:5000/

it takes about 7 seconds(and even 1 min on mobile device) to open, during which we can only see the 'ajax-loader.gif'.

This exceeds my imagination of .net core and blazor.

Could you tell me what's going on during that loading time?

I can come up with a few possibilities:

  • my method of starting server(same as readme) is not optimized --- if so, any way to make it release version?
  • the database initializing --- if so, is there any way to skip the db initilizing temporialy, just let the user see homepage as soon as possible?
  • blazor itself needs the .net core runtime download --- is it true?

Do you have a web page that hosts this code(as a live demo)?

Thanks!

@kalintsenkov
Copy link
Owner

kalintsenkov commented Dec 7, 2020

Hi, @LeiYangGH,

  1. You should deploy release version
  2. You can skip the db initialization if you remove .Initialize() method from Startup class in Web.Server project
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
            => app
                .UseExceptionHandling(env)
                .UseValidationExceptionHandler()
                .UseHttpsRedirection()
                .UseBlazorFrameworkFiles()
                .UseStaticFiles()
                .UseRouting()
                .UseAuthentication()
                .UseAuthorization()
                .UseEndpoints()
                .Initialize(); // this one
  1. That's true.
  2. I don't have live demo, but I will add it in future. 🙂
  • Where did you deploy the app? Make sure database and web app are deployed in same region.

@LeiYangGH
Copy link
Author

LeiYangGH commented Dec 7, 2020

Hi @kalintsenkov
I deployed in China Ali cloud. Db and web is in the same server.
I use mysql so i modified many db types and i found mysql ef lib cannot set auto increase id correctly, so my db actually cannot correctly setup.

I'll try your ways to use release version as well as skip db init. and feedback.

==========update===========
I just

  1. skipped Initialize
  2. ran dotnet publish -c Release and start the generated binary BlazorShop.Web.Server, and now the load time reduced to 3 seconds.

Not satisfied but progressing...

Do you need a server to host the demo? if you need i can provide my server as a ci live demo server.(i use mysql)

====update===
i also hosted dotnet built in blazor sample project here: http://leiyang.icu:8080/. it loads within 1 second.

@harirajrv
Copy link

The latest version code is not working.

Commented the .Initialize();

Only the loading gif is showing, tried Release, and Debug modes with VS.

@LeiYangGH
Copy link
Author

too long no response. so the test env metioned above might be gone.

@harirajrv
Copy link

I took the repository into a new folder then it worked well, this time I used the console window to run it as mentioned in the ReadMe

And I was doing some changes in the CSS and razor HTML files, also I saw the changes I did, it was working normally.

After a while today it's stopped working again, now it's showing only the loading image.

I didn't do anything specific to the environment or C# code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants