Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Public site seems something wrong #5868


User avatar
0
fguo created

I updated to “ASP.NET Core & Angular” v6.1.0, and trying it on development envirement. The core and Angular parts work fine, but the Public site seems something wrong.

I set both "web.Host" and "web.public" as startup projects. When I start the solution with chrome, the public site screen is ugly, looks like some themes or style sheets are not loaded. I click the "Login" on screen. it redirect me to localhost:4200. After I login with my own credential, it redirects me back to localhost:45776 showing my username on screen, which is correct, but the screen is frozed there.

I tried to start with microsoft edge. The public site screen is still ugly, This time I can't login with my own credential. I tried to use the built-in (admin/123qwe), it then asked me to change password.

Is it something wrong in your code, or on my side? Please advise.

Thanks,


17 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @fguo

    Have you created bundles before running the public project ?

  • User Avatar
    0
    fguo created

    I have no idea about "create bundles". Can you explain more?

    For preiours version (v5.0) I just run public project as I described above.

  • User Avatar
    0
    ryancyq created
    Support Team

    Hi, can you check if there is any errors in the browser console.

    as mentioned by @ismcagdas, you can run npm run create-bundles for your public website project.

  • User Avatar
    0
    fguo created

    There is no package.json in * .Web.Public folder. Here is the error while running npm run create-bundles:

    npm ERR! path ...Web.Public\package.json npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory, open '...Web.Public\package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent

  • User Avatar
    0
    aaron created
    Support Team

    Check:

    • browser console for JavaScript errors, and
    • *.Web.Public/App_Data/Logs.txt for server errors.
  • User Avatar
    0
    fguo created

    I tried it with Edge and Chrome and get different errors as screen shot here:

    I checked Web.Public/App_Data/Logs.txt. There is no "ERROR", but some "INFO" looks like error 404. Here are several lines for excample.

    INFO 2018-11-05 12:48:42,937 [16 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost:45776/lib/fancyBox/source/jquery.fancybox.css
    INFO 2018-11-05 12:48:42,940 [12 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost:45776/lib/owl.carousel/dist/assets/owl.carousel.css
    INFO 2018-11-05 12:48:42,944 [26 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost:45776/Common/_Bundles/common-styles.css
    INFO 2018-11-05 12:48:42,950 [12 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 13.0063ms 404 INFO 2018-11-05 12:48:42,950 [26 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 6.0922ms 404 INFO 2018-11-05 12:48:42,950 [16 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 13.0096ms 404

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @

    Install https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BundlerMinifier and run it once on the *.Web.Public project once.

  • User Avatar
    0
    fguo created

    Thank you for direction. I installed it and updated Bundles exactly as your above picture. However, it still runs with error:

    1. After update bundles:

    2. Public page still missed styles:

    3. Click "Login" to redirect to login page without error:

    4. After login, it redirect to public page, but the username is not clickable, so can't logout:

  • User Avatar
    0
    mumfie created

    did you restore the packages in wwwroot\lib ? I think the public site is before Yarn/npm was used but you can right click on bower.json in vs solution explorer

  • User Avatar
    0
    fguo created

    Oh, I missed it. Just restored packages on Dependencies/Bower. The page style looks good now. BUT, while logout from the public page, I get a popup with "InternalServerError". After I click "Ok" on that popup, the page directs to Localhost:4200 with blank page. I checked the log.txt, there are two "WARN":

    WARN 2018-11-08 15:42:47,803 [19 ] naries.DictionaryBasedLocalizationSource - Can not find 'Left' in localization source 'MyProject'! WARN 2018-11-08 15:42:47,803 [19 ] naries.DictionaryBasedLocalizationSource - Can not find 'Right' in localization source 'MyProject'!

  • User Avatar
    0
    ryancyq created
    Support Team

    is the log.txt from public project?

    warning should not cause internal server error, can you check the log.txt in web.host project?

  • User Avatar
    0
    fguo created

    Yes. The above WARNs was from the log.txt in public project.

    I checked the log.txt in web.host project, but there is no "ERROR" during that peroid of time.

  • User Avatar
    0
    mumfie created

    are the urls in appsettings.json correct for each project and does the javascript console show any error ?

  • User Avatar
    0
    fguo created

    The appsettings.json should be ok, I didn't change anything except the connectionstring. It works fine while "login". It only gets the error while "Logout". I checked log.txt in both web.host and we.public. There is no "ERROR". The concole shows two 404 errors while "Logout" as below:

  • User Avatar
    0
    ryancyq created
    Support Team

    the url of your logout api call seems wrong.

    /undefined/api/TokenAuth

  • User Avatar
    0
    fguo created

    That is my question. I didn't modify any API code. Why does it call http://localhost:4200/undefined/api/TokenAuth? What is it suppostly? Is it a bug of ANZ v6.2.1? Can you reproduce this error on your side?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @fguo

    Could you create an issue here https://github.com/aspnetzero/aspnet-zero-core/issues/new. There might be a bug.