Base solution for your next web application
Open Closed

ASPNET.ZERO not working correctly in release mode. #5281


User avatar
0
kyckradmin created

Hi Folks, We have an ASP.CORE 2.1 MVC+JQuery application, based on the v5.5 templates. When we run this in debug mode on the developers machine everything works fines.

If we switch to release mode on a developer box the Login screen appears, but once we successfully login, we don't move onto the next screen we get the following JSON response back,

{"result":null,"targetUrl":"/App","success":true,"error":null,"unAuthorizedRequest":false,"__abp":true}

but no UI elements. It's the JSON that renders in the browser, it's as if it is missing generating the View altogether.

I'm just wondering if anyone has experienced this before and may know what the issue is. We have a similar issue when we deploy to Azure, but at least we can reproduce it locally here in release mode.

Point Of Interest If we then take the targetURL from above, and paste it into the browser, it displays the App page, but none of the action buttons work.

The only change we have made locally is to point to a local instance of a SQLEXPRESS database.


17 Answer(s)
  • User Avatar
    0
    trendline created

    Please reference this #5267, it seems we encountered the same issue.

  • User Avatar
    0
    maliming created
    Support Team

    You can open the browser's development tool to see if there is javascript file not loaded successfully, or javascript script to perform wrong output.

  • User Avatar
    0
    geek1913 created

    I have the same issue with same version.

    I noticed that the "/Account/Login" page fails to load "/view-resources/Areas/App/Views/_Bundles/account-layout-libs.min.css"

    I have run yarn and npm run create-bundles but it doesn't seem to minify everything.

  • User Avatar
    0
    maliming created
    Support Team

    hi geek1913

    What is the output of npm run create-bundles?

  • User Avatar
    0
    alper created
    Support Team
    • delete all BIN & OBJ folders
    • delete node_modules folder
    • run YARN
  • User Avatar
    0
    kyckradmin created

    Hi Folks, I actually found the problem that was causing the issues I was experiencing, I'm not sure if it's related to other who are facing similar issues.

    I was running the "Delete BIN OBJ Folder.bat" before doing a release build. I found that this was deleting some bin folders in the node_modules folder (I presume this was unintentional), which was causing the release build on the npm run create-bundlesto fail. I had not noticed this in our build output. When switching back to Debug I was clearing down the node modules folder and and doing an npm install again, which is why I did not experience the issue when developing.

  • User Avatar
    0
    maliming created
    Support Team

    As it turns out, [Delete BIN OBJ Folders] needs to exclude the node_modules directory. :D

  • User Avatar
    0
    geek1913 created

    This helped with the logon resulting in json issue. I now get to the dashboard as expected. Thx!

    I still have an issue with the Admin menu expanding. It changes what ever URL i'm currently on to URL#. This could be something with the settings. I was playing with the those before the other json issue showed up.

  • User Avatar
    0
    alper created
    Support Team

    I will share the new content of the Delete BIN & OBJ folders.bat excluding the node_modules folder.

  • User Avatar
    0
    kyckradmin created

    That would be great. I had a look at doing it in the batch file, but couldn't figure out how to exclude the node modules without switching it to Powershell or some other half decent scripting language. At this stage BAT files should should be like the Doedoe.

  • User Avatar
    0
    alper created
    Support Team

    Hi,

    Here's the updated *.bat file that excludes BIN & OBJ folders in node_modules folder.

    [attachment=0:i3y8uas7]Delete-BIN-OBJ-Folders.zip[/attachment:i3y8uas7]

    Content:

    @ECHO off
    cls
    
    ECHO Deleting all BIN and OBJ folders...
    ECHO.
    
    FOR /d /r . %%d in (bin,obj) DO (
    	IF EXIST "%%d" (		 	 
    		ECHO %%d | FIND /I "\node_modules\" > Nul && ( 
    			ECHO.Skipping: %%d
    		) || (
    			ECHO.Deleting: %%d
    			rd /s/q "%%d"
    		)
    	)
    )
    
    ECHO.
    ECHO.BIN and OBJ folders have been successfully deleted. Press any key to exit.
    pause > nul
    

    Related GitHub Issue: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1338">https://github.com/aspnetzero/aspnet-ze ... ssues/1338</a> Delete-BIN-OBJ-Folders.zip

  • User Avatar
    0
    geek1913 created

    thx @alper, this new Delete file and the new npm "Full-Build" command have fixed me up!

  • User Avatar
    0
    alper created
    Support Team

    perfect! happy coding ;)

  • User Avatar
    0
    cengiz created

    Hi, I have that same problem. We need to follow a path to solve the problem.

    {"result":null,"targetUrl":"/Account/ResetPassword?UserId=1&ResetCode=BE1522B167&ReturnUrl=%2FAdmin","success":true,"error":null,"unAuthorizedRequest":false,"__abp":true}
    

    Thank you for your help.

  • User Avatar
    0
    ashgadala created

    Thank you so much everyone. Deleting the the obj and bin folders helped resolve the issue as well. Except the fact that i found this after two days of struggling. I wish this happened earlier.

    Also, It would better if we can have instructions on deployment as well in the ASPNETZERO with out having to redirect to the microsoft documentation.

  • User Avatar
    0
    muleso created

    Atlast i log in.

    But not data displayed and can't expand admin menu item

  • User Avatar
    0
    ismcagdas created
    Support Team

    @muleso we have replied your email about this problem. Since you have javascript errors, app doesn't work properly.

    In order to run the app properly, please follow <a class="postlink" href="https://aspnetzero.com/Documents/Getting-Started-Core">https://aspnetzero.com/Documents/Getting-Started-Core</a>.