Hi there,
i'm trying to work with the UserAppService on a side temp console application i've created. the code:
using Abp.Dependency; using Next.Ride.Authorization.Roles; using Next.Ride.Authorization.Users; using Next.Ride.Authorization.Users.Dto; using Next.Ride.Authorization.Users.Exporting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace testAbp { class Program { static void Main(string[] args) { IUserAppService userService = IocManager.Instance.Resolve<IUserAppService>(); var result = userService.GetUsers(new GetUsersInput()); } } }
Error: Additional information: No component for supporting the service Next.Ride.Authorization.Users.IUserAppService was found Question: What am i missing? can you share a simple program to show how to retrieve User and use the UserAppService independently from the web application.
10 Answer(s)
-
0
Hi,
There are many missing in your code. There is no ABP initialization code and module definition at all.
There is a sample console application here:
<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate-samples/blob/master/AbpEfConsoleApp/AbpEfConsoleApp/Program.cs">https://github.com/aspnetboilerplate/as ... Program.cs</a>
This does not use AspNet Zero but can give an idea for you. If you can not implement it, I should prepare a working sample project for you.
-
0
I tried and still having difficulties to sort my way out of it. :oops: I have a console application the needs to get list of users, I would appreciate you share a short example / just the source code would be good
-
0
OK, then I will prepare a demo for you.
-
0
I prepared a Console Application for the Phone Book sample (developed here: <a class="postlink" href="http://www.aspnetzero.com/Documents/Developing-Step-By-Step">http://www.aspnetzero.com/Documents/Dev ... ep-By-Step</a>).
Same code will work for any AspNet Zero based project.
Source code: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-samples">https://github.com/aspnetzero/aspnet-zero-samples</a> (<a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-samples/tree/master/PhoneBook/src/Acme.PhoneBook.ConsoleApp">https://github.com/aspnetzero/aspnet-ze ... ConsoleApp</a>).
As a brief;
- Created a Console Application
- Installed "Abp.Zero.EntityFramework" nuget package to the console app
- Add connection string to App.config
- Created the module definition file (<a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-samples/blob/master/PhoneBook/src/Acme.PhoneBook.ConsoleApp/PhoneBookConsoleAppModule.cs">https://github.com/aspnetzero/aspnet-ze ... pModule.cs</a>) and overrided session and permission checker.
- Created a class that uses repository and app service (<a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-samples/blob/master/PhoneBook/src/Acme.PhoneBook.ConsoleApp/UserLister.cs">https://github.com/aspnetzero/aspnet-ze ... rLister.cs</a>)
- Initialized ABP framework (<a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-samples/blob/master/PhoneBook/src/Acme.PhoneBook.ConsoleApp/Program.cs">https://github.com/aspnetzero/aspnet-ze ... Program.cs</a>)
Source Code includes some comments.
Have a nice day.
-
0
all the url's links in your reply are broken
-
0
Hi,
It's a private Github repository, so you should have permission to see it. Please send your Github user name to <a href="mailto:[email protected]">[email protected]</a> and we grant access for you.
Thanks a lot.
-
0
Hi. Is it possible to get an updated version of the example that you are referring in this post?
I am trying to create a standalone windows service that uses abp to get list of Entity's and send email Thanks
-
0
Hi @agmachado,
Is your service for getting list of Entities requires authentication & permission check ? If not, it is easy, you can check this example <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/AbpEfConsoleApp">https://github.com/aspnetboilerplate/as ... ConsoleApp</a>.
Thanks.
-
0
Hi ismcagdas
Thanks for your reply
Authentication / permission check is not required because is a local service but i would like use the same database that i defined in myproject.EntityFrameworkCore and the same librarys classes and methods defined in myproject.Application and myproject.Core
I would like use localization and time zone settings too
Thanks
-
0
Hi,
You can depend your windows service's module on your EntityFramework and Application modules. In that way, you can use same db and app services.
But if your app service requires authorization & authentication, you need to use a static user by overriding AbpSession in your windows service.
Thanks, Have a nice day.