by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Dody Gunawinata
    @dodyg
    @alsami thanks for the heads up. I haven't followed Autofac since ASP.NET Core was released.
    riosje
    @riosje
    Hi guys,
    some one could bring to me any idea to build an inmutable Microservice to schedule transactions.
    Actually i've done an API that handle all transactions, but i need to schedule some transactiosn i was thinking on design another API SCHEDULER, so, when the TRANSACTION is on the date schedule will send the REQUEST AGAIN to TRANSACTION API
    I'm thinking in QUARTZ or HANGFIRE.
    Some another ideas?
    It's very simple but also very limited. It might be fine for your scenario if you just has one task to check the API in a fixed time.
    riosje
    @riosje
    thanks, a lot to take the time an read my question.
    How to handle data persistence and Immutability of tasks?
    Mike Hingley
    @computamike
    I have a question : Previously I've developed MVC apps using NodeJS - and as part of that I was able to provide administration scripts - for instance I could ssh onto the server and run an import script that could import data into the DB, using all the nice models and stuff. In ASP.NET MVC world - what would be the equivalent? Or do I need to build a Web front end for these sort of tasks? I was also thinking about retiring data - like in terms of data retention periods. In NodeJS world we might run a script that strips out the data outside the retention period. How would I do something similar with ASP.NET MVC?
    Tommy Williams
    @twwilliams
    @computamike: You could implement the equivalent of that script as an action on a controller. Then just call the URL to run it. You don't need to build a view or any other HTML. As far as retiring data: if you want to do it manually, do the same as above. Or you could implement a scheduled task on your server--this is like a cron job in Linux. The scheduled task could call an action on a controller in your MVC site or you could just implement the scheduled task as a Console application.
    Mike Hingley
    @computamike
    @twwilliams Thanks Tommy both great ideas - What I like about them is that this retention process then is as important as the thing that the site does - the code for it is testable (for example) and isn't just like "a script that we run"...
    I've just tweeted a potential bug in aspnetcore
    i'll paste it here :
    hmm - thought that it might recognise the twitter link and draw it a bit nicer...
    I'll try pasting the embed tweet code here

    well basically

    • I start with a standard web application
    • I can run dotnet ef and Entity Framework pops up.
    • I add orchestration support (this adds a .dcproj file).

    dotnet ef no longer works - moans that there are 2 project files

    I can delete the .dcproj file (and potenitally restore it) - but that makes running migrations difficult as part of a project build.

    Dody Gunawinata
    @dodyg

    thanks, a lot to take the time an read my question.
    How to handle data persistence and Immutability of tasks?

    @riosje https://www.litedb.org/. It's small and easy to embed.

    Greg
    @TurboKia
    I just finished watching the ASP.Net Core 101 series of videos, which were a big help. I'm coming from a Web Forms background and dragging my heels about Razor and EF. Our sites are very "Form" intensive. Blazor looks and acts like a user-control, which is nice. Is there an advance Video series along the same lines of the ASP.net Core 101 videos?
    kmteam
    @kmteam
    Hi *

    Sorry but I'm closer to getting crazy...
    I want dashboard be my starting controller when I started my asp.net core web app so I've defined it in my Configure method such like...

     app.UseMvc(routes =>
                {
                    routes.MapRoute(
                        name: "default",
                        template: "{controller=Dashboard}/{action=Index}");
                });

    And I also defined my DashBoard controlled as ...

        [Route("[controller]")]
        public class DashboardController : Controller
        {

    But when I start the IIS it seems doesn't work as is not loading the Dashboard tought If I'd wrote /Dashboard it works.

    Any idea what I'm doing wrong?
    Thnks!

    bmoteria
    @bmoteria

    Hey guys!

    I have ran into windows authentication issue. Could someone please explain the difference between User.IsInRole("Users") and User.IsInRole("DOMAIN\\Users")?

    When I call User.IsInRole("DOMAIN\\Users"), it takes forever (~ 3000ms to 9000ms) and returns false which blows my mind away.

    And with User.IsInRole("DOMAIN\\Users"), it takes between 2ms to 128ms.

    Philipp Dolder
    @philippdolder
    @bmoteria I guess you actually mean User.IsInRole("Users") takes only 2ms to 128ms? I would expect DOMAIN\\Users is doing a lookup in the AD e.g. call to your network while Users is just checking in the local machine user groups
    bmoteria
    @bmoteria
    @philippdolder Yes, I actually mean User.IsInRole("Users"). Sorry for the typo. Thank you for the info. In my case, the AD server is too far for the application hence it's taking very long duringUser.IsInRole("DOMAIN\\Users").
    Philipp Dolder
    @philippdolder
    @bmoteria if you can't change the response time of your AD server to something pretty fast, your app will not run with acceptable performance :-( an option would be to have a very fast, closeby read-only AD mirror
    bmoteria
    @bmoteria
    @philippdolder Unfortunately, having closeby AD or read-only AD mirror options are not available to me. Most of the apps we built was meant to be unsed internally - next to the AD server. But due to this global pandemic, majority of our internal customer are now working remotely which means the applications are now being used both internally and externally. It would my dream to have AD on cloud.
    bmoteria
    @bmoteria
    We don't have any choice. For now, we have keep using Citrix workspace. When accessing internal web apps through citrix it works just fine.
    Philipp Dolder
    @philippdolder
    @bmoteria a read-only AD mirror on Azure would be a really nice solution :-) btw. if your company is using Office 365 chances are your company already has an AD mirror set up in azure, https://docs.microsoft.com/en-us/office365/enterprise/office-365-integration
    bmoteria
    @bmoteria
    @philippdolder 99.9% of everything is on-premise. That being said, our company doesn't use Office 365. In fact due to monthy (variable) price tag and security concerns with cloud services, my company didn't wanted to move ahead with cloud. But because of this pandemic they are thinking whether they should move towards cloud. 🤞
    epimeth
    @epimeth

    so this is all sorts of weird.... and please tell me where I should go to for support on this if this isn't the right place!
    I am utilizing Microsoft.AspNetCore.JsonPatch and am sending the following patch to my api:

    [
      {
      "op": "add",
      "path": "/claims/baManager/-",
      "value": "adsffadsdfas"
      },
      {
      "op": "add",
      "path": "/claims/Groups/-", // also tried with /claims/groups/-
      "value": "agroup"
      }
    ]

    the relevant part of the model I am updating:

            /// <summary>
            /// Claims
            /// </summary>
            public Dictionary<string, List<string>> Claims { get; set; } = new Dictionary<string, List<string>>();

    so here's the weirdness... baManager gets an item added to it... groups does not.

    For operation 'add', the target location specified by path '/claims/Groups/-' was not found.

    what in the heck is going on, here?

    Dody Gunawinata
    @dodyg
    @epimeth the shape looks wrong. Try public List<Dictionary<string, string>> Claims
    Denis
    @redradist
    Hi all< I have faced with strange issue:
    Waiting for the IIS Express worker process to start…
    Worker process has been started: 13984
    Application startup exception: System.InvalidOperationException: Unable to find the required services. Please add all the required services by calling 'IServiceCollection.AddControllers' inside the call to 'ConfigureServices(...)' in the application startup code.
    at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.EnsureControllerServices(IEndpointRouteBuilder endpoints)
    at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapDefaultControllerRoute(IEndpointRouteBuilder endpoints)
    at SomeApp.Web.Server.Startup.<>c.<Configure>b1_0(IEndpointRouteBuilder endpoints) in G:\Projects\Programing\Cash\SomeApp.ASP.NET\SomeApp.Web.Server\Startup.cs:line 42
    at Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseEndpoints(IApplicationBuilder builder, Action`1 configure)
    at SomeApp.Web.Server.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env) in G:\Projects\Programing\Cash\SomeApp.ASP.NET\SomeApp.Web.Server\Startup.cs:line 40
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
    at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c
    DisplayClass4_0.<Build>b0(IApplicationBuilder builder)
    at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
    at Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<>c
    DisplayClass4_0.<Configure>b0(IApplicationBuilder app)
    at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c
    DisplayClass0_0.<Configure>b0(IApplicationBuilder app)
    at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication()
    crit: Microsoft.AspNetCore.Hosting.WebHost[6]
    Application startup exception
    System.InvalidOperationException: Unable to find the required services. Please add all the required services by calling 'IServiceCollection.AddControllers' inside the call to 'ConfigureServices(...)' in the application startup code.
    at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.EnsureControllerServices(IEndpointRouteBuilder endpoints)
    at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapDefaultControllerRoute(IEndpointRouteBuilder endpoints)
    at SomeApp.Web.Server.Startup.<>c.<Configure>b
    1_0(IEndpointRouteBuilder endpoints) in G:\Projects\Programing\Cash\SomeApp.ASP.NET\SomeApp.Web.Server\Startup.cs:line 42
    at Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseEndpoints(IApplicationBuilder builder, Action`1 configure)
    at SomeApp.Web.Server.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env) in G:\Projects\Programing\Cash\SomeApp.ASP.NET\SomeApp.Web.Server\Startup.cs:line 40
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
    at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>cDisplayClass4_0.<Build>b0(IApplicationBuilder builder)
    at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
    at Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<>cDisplayClass4_0.<Configure>b0(IApplicationBuilder app)
    at Microsoft.AspNetCore.HostFilteringStartupFilter.<>cDisplayClass0_0.<Configure>b0(IApplicationBuilder app)
    at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication()
    Hosting environment: Development
    Content root path: G:\Projects\Programing\Cash\SomeApp.ASP.NET\SomeApp
    1 reply
    I cannot figure out what does it mean ... Any help will be appreciated ...
    Dody Gunawinata
    @dodyg
    Please add all the required services by calling 'IServiceCollection.AddControllers' inside the call to 'ConfigureServices(...)' in the application startup code.
    The solution is there. Services.AddControllers();
    Sami Al Khatib
    @alsami
    Hey there. Anyone tried upgrading their projects to .net5 TFM and has failing api/mvc integration tests now? Apparently the test server does not find the controllers any more all endpoints returning 404.
    Dody Gunawinata
    @dodyg
    Ok that's weird. Do you still have the problem?
    Somnath Chowdhury
    @madewithfire
    I have created a sample Web API project. now I add controllers into a separate class library project. I am able to use those api. I add swagger package in class library project for documentations but I am not able to access swagger. Is swagger suppose to work if I add packages in class library project instead of Web API Project.
    Sami Al Khatib
    @alsami
    @dodyg yes, actually it magically fixed itself somehow the other I reopened the solution. Guess it somehow did not compile properly for whatever reason

    I have created a sample Web API project. now I add controllers into a separate class library project. I am able to use those api. I add swagger package in class library project for documentations but I am not able to access swagger. Is swagger suppose to work if I add packages in class library project instead of Web API Project.

    Yes, that should work. Are you calling services.AddSwagger(...config) and app.UseSwaggerUi() as well?

    Somnath Chowdhury
    @madewithfire
    yes I did but no luck . @alsami
    Sami Al Khatib
    @alsami
    what's the error you get when you open the address http:localhost:<port>/swagger?
    Sami Al Khatib
    @alsami
    @madewithfire I actually tried to make it work again but I always get fetch error for swagger.json in swagger-ui
    I also found several issues describing that there are problems when using endpoint routing
    I also had a controller within a dedicated assembly and one in the root project, still does not work to fetch the swagger.json. It's probably not being generated.
    here the repository if you want to check it out:
    https://github.com/alsami/SwaggerControllerLibrary
    Sami Al Khatib
    @alsami
    I have it working though in a different side-project that is a lot bigger:
    https://github.com/entertainment-database/Etdb.UserService.AspNetCore
    Needs to be run with ASPNETCORE_Environment = ClientGenthough
    Somnath Chowdhury
    @madewithfire
    Thanks @alsami , I have same issue with swagger-ui and I doubt for this specific scenario swagger is not able identify the available api in current assembly.
    Sami Al Khatib
    @alsami

    Thanks @alsami , I have same issue with swagger-ui and I doubt for this specific scenario swagger is not able identify the available api in current assembly.

    I've actually figured it out. It's really not the location of the controllers but the fact, that all the parameters for the swagger-gen and ui must match exactly.

    If you want I can update the Repo
    Philipp Dolder
    @philippdolder
    Howdy people.
    Has someone experience with a bit more complex validation (not the logic itself is complex, but the validation scenario) in Blazor?
    I have a textbox that should be validated. The user can either enter text by himself. Or he can choose an element from a tree control that will be written to that text box. The issue I'm having is that I don't find a way to trigger the validation when the user selects an item in the tree. Selecting the element from the tree will change the value of the model via code, and apparently not by the user changing its content. Changing the model value directly doesn't trigger the validation as I understand.
    Does anyone can give a hint where I should look?