Used abp cli to create mvc app including Books sample code.
Expected: book page (for example https://localhost:44392/Books) to have a working "New book" button
Observed: "New book" button did not work
Note: may work on Windows but not on Linux
To reproduce see:
https://github.com/magentuseu/abp-tests
6 Answer(s)
-
0
- Solution
Root cause: In the MVC Book Store sample, the New Book button uses ABP’s ModalManager and generated JavaScript proxies. If the global proxy namespace isn’t initialized on the page, clicking “New book” won’t do anything. On some setups (often Linux or when script order/bundling differs), the proxy object path can be undefined, so the button appears but the click handler silently fails.
Quick fix in Pages/Books/Index.js:
- Locate the line initializing the service proxy. It typically looks like: var bookService = bookStore.books.book;
- Change it to use the correct global namespace that ABP emits: var bookService = window.myBookStore.books.book;
Ensure the page includes the generated JS proxies before Index.js:
- In Pages/Books/Index.cshtml, verify the scripts section: @section scripts { <abp-script src="/Abp/ApplicationConfigurationScript" /> <abp-script src="/AbpServiceProxies.js" /> <abp-script src="/Pages/Books/Index.js" /> } This guarantees the proxies and application configuration are loaded before your Index.js.
Verify bundling isn’t stripping or reordering required scripts:
- If you customized bundling, ensure Volo.Abp.AspNetCore.Mvc.UI.Bundling includes AbpServiceProxies.js (either via default bundles or your bundle contributors) and that Index.js is loaded after it.
Double-check the selector and click handler wiring:
- The button ID in Index.cshtml must match the code: <abp-button id="NewBookButton" ... />
- In Index.js: $('#NewBookButton').click(function (e) { e.preventDefault(); createModal.open(); });
If the modal still doesn’t open:
- Confirm the modal pages exist and are routable: new abp.ModalManager(abp.appPath + 'Books/CreateModal'); new abp.ModalManager(abp.appPath + 'Books/EditModal'); Ensure Pages/Books/CreateModal.cshtml and EditModal.cshtml are present and the Razor page routes match (no folder/area mismatch).
- Check permissions: the button is often wrapped with permission checks. Make sure the current user has BookStore.Books.Create.
Note on OS differences (Linux vs Windows):
- File name case sensitivity: On Linux, file paths are case-sensitive. Ensure the script and page file names and paths referenced in code exactly match their casing on disk (e.g., Index.js vs index.js; Books/CreateModal vs books/createmodal).
- Sources
- ABP GitHub issue/workaround that matches the undefined proxy namespace problem on generated MVC CRUD (fix by using window.myBookStore.books.book):
- https://github.com/abpframework/abp
- Repro repository you shared:
- https://github.com/magentuseu/abp-tests
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
hi
Can you zip your project and share with liming.ma@volosoft.com
I will check it.
Thanks
-
0
See https://github.com/magentuseu/abp-tests ready and reproducing the problem.
-
0
hi
Please make this repository PRIVATE, it contains your API KEY.
-
0
Can I use the
mvc_no_saasproject reproduce the problem?Thanks.
-
0
use the mvc_no_saas project to reproduce the problem use the devcontainer as the problem may be related to Linux only
Please also modify gitignore in "abp new" not to publish api key.