Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    TeBeCo
    @tebeco
    and you'll need Authentication in order to have Authorization possible
    (same google search by changing the last word)
    and you'll need to choose an OAuth2 Provider like AzureAd / IdentityServer4 if you want to own it or you could also rely on existing account from user to link it line msft live / github / Auth0 / twitter / google / .... there's A LOT of possibility
    Alok Sharma
    @aloksharma1
    i have a few entity with HasNoKey() property, now whenever i call the Add or AddRange method i am getting following error :
    Unable to track an instance of type 'ApplicationUserRoles' because it does not have a primary key. Only entity types with primary keys may be tracked.'
    ABDULRAZZAK ALSSSOUKI
    @Abdalrzakalsouki
    Hello, I'm a new member and I would like to ask if I can get some help regarding an API publishing error
    Alok Sharma
    @aloksharma1

    Hello, I'm a new member and I would like to ask if I can get some help regarding an API publishing error

    can you explain more just saying web api error doesnt tell us anything

    ABDULRAZZAK ALSSSOUKI
    @Abdalrzakalsouki

    I have a problem with publishing net core API into Azure
    I have a net core 3.1 REST API and I want to publish it into Azure. I started by following this article:
    https://docs.microsoft.com/en-us/aspnet/core/tutorials/publish-to-azure-api-management-using-vs?view=aspnetcore-5.0

    When I added Swagger I encountered a problem with a generic error 'HTTP ERRO 550.30' after installing version 3 of the Swashbuckle.AspNetCore package. When I install the last version the API works again locally but I can not publish it into Azure because swagger could not make the swagger JSON file.
    I tried many suggestions from GitHub and StackOverflow and nothing worked!
    Note: if I moved into version 3.0.0 from the library I can publish the API but end again with 'HTTP ERRO 550.30'

    Finally, I encounter today a different error even that I did not change anything on the code which is:
    'Web deployment task failed. (Web Deploy cannot modify the file 'BuildingRestAPI.dll' on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock or use the AppOffline rule handler for .Net applications on your next publish attempt. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE. '

    Ambulatur
    @AMBULATUR
    Good day, there is a hosting on which i can run a web application only with the .net Framework 4.5 (.0) version, is it possible to somehow ignore and run DotVVM which requires the framework 4.5.1 version>= ?
    TeBeCo
    @tebeco

    :newspaper: | .NET Framework 4.5.2, 4.6, 4.6.1 will reach End of Support on April 26, 2022

    https://devblogs.microsoft.com/dotnet/net-framework-4-5-2-4-6-4-6-1-will-reach-end-of-support-on-april-26-2022/

    you can't really remove a TFM constraint
    use an other version or rebuild the code yourself
    given that it's a tech that is almost 10yo, migrate ASAP to net48 minimal version
    (or .net5)
    vikeshkataria
    @vikeshkataria

    I am getting 502 Bad gateway reverse proxy server , when i am accessing API.

    Configured krestel service port on 5001 and defined into appsetting.json

    I performed these steps

    1. Publish code through command for Linux :
      dotnet publish --self-contained -c Release -r linux-x64
    2. Copied published data on var/www/API folder
    3. Created krestel service with below configuration

             [Unit]
             Description=WebAPIApp
             [Service]
             WorkingDirectory=/var/www/API
             ExecStart=/usr/bin/dotnet /var/www/API/WebAPI.dll
             Restart=always
             # Restart service after 10 seconds if the dotnet service crashes:
             RestartSec=10
             KillSignal=SIGINT
             SyslogIdentifier=dotnet-example
             User=www-data
             Environment=ASPNETCORE_ENVIRONMENT=Production
      
             Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
      
             [Install]
             WantedBy=multi-user.target
    4. tested krestel service and its working without any error.
    5. Now, I created site on nginx with below configuration
             server {
             listen        4001;
             location / {
                 proxy_pass         http://MachineNamewithDomain:5001;
                 proxy_http_version 1.1;
                 proxy_set_header   Upgrade $http_upgrade;
                 proxy_set_header   Connection keep-alive;
                 proxy_set_header   Host $host;
                 proxy_cache_bypass $http_upgrade;
                 proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
                 proxy_set_header   X-Forwarded-Proto $scheme;
             }
         }
    6. enabled site in sites-enabled directory..
    7. allowed or open 4001 ,5001 port on network.
    8. i made entry on /etc/hosts as well defined URL
      10.10.10.10 API
    9. reboot of machine.
    10. After reboot, I checked service is Up and running on port number 4001 .. I tried to access swagger and it is also working but
      when i am executing API its execute only once after that it is giving 502 bad gateway error.. I checked the logs there was nothing.
      11 then i tried to access krestel service , its also running and up.. I tried to access swagger , it is also working and able to access all API without any error.

    11. I configured krestel service URL (port number 5001) with Angular UI.. Application is working now but i observed two challanges there

      1. sometimes it is not responding and response is coming blank.. I check on browser network HTTPstatuscode 200
      2. Paralle request genrating from UI ( 20 requests of same single API ) in that case it is taking time and few requests converting into CORS error and getting response of some request.. i checked the log i am getting socket exception error
        2021-04-26 06:10:52,700 [139] ERROR System.Threading.Tasks.TaskCanceledException: The operation was canceled.
        ---> System.IO.IOException: Unable to read data from the transport connection: Operation canceled.
        ---> System.Net.Sockets.SocketException (125): Operation canceled
        --- End of inner exception stack trace ---
        at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
        at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token)
        at System.Net.Http.HttpConnection.FillAsync()
        at System.Net.Http.HttpConnection.ReadNextResponseHeaderLineAsync(Boolean foldedHeadersAllowed)
        at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
        --- End of inner exception stack trace ---
        at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
        at System.Net.Http.HttpConnectionPool.SendWithNtConnectionAuthAsync(HttpConnection connection, HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
        at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequ
    Taylor
    @TaylorWatson

    hey guys when init a singleton or scoped service. Is it possible to have two interfaces?

    I have IStateContainer for example, but I also have an IAbsorb interface as well.

    Is there a way to do
    services.AddSingleton<IStateContainer, IAbsorb, StateContainer>(); or something similar? So I can pass in either interface into other services or razor pages?

    TeBeCo
    @tebeco
    init?
    Taylor
    @TaylorWatson
    oops, when registering a service **
    my mind went somewhere else and mixed two things

    ahhhh for those looking for the answer, I got it :)

    services.AddSingleton<Foo>(); // We must explicitly register Foo
    services.AddSingleton<IFoo>(x => x.GetRequiredService<Foo>()); // Forward requests to Foo
    services.AddSingleton<IBar>(x => x.GetRequiredService<Foo>()); // Forward requests to Foo

    odd but I get it I guess
    TeBeCo
    @tebeco
    every single request create a scope inside Aspnetcore
    so using scoped services that are heavy to create will benefits from it
    or when you need to be sure vthat every layer of your app use the same instance of a thing during all that same request
    that's why a part of db context related stuff are scoped
    making sure you scale (each request has it own)
    but a request use the same "context" to not shoot you in the foot
    Taylor
    @TaylorWatson
    I share services between apps, and some apps need more inside the state container than the generic stuff. So this is helpful because like you said. I don't have to create the entire service to get access to the few things.
    TeBeCo
    @tebeco
    "between apps" sound fishy
    can't tell
    the DI container only exists once per app
    if you are sharing things accros app maybe you need to use a distributed cache to store the data
    or just expose route
    Arcanox
    @ArcanoxDragon
    I'm seeing some strange behavior with an ASP.NET Core application hosted in IIS. Regardless of what I have for Idle Time-Out and Recycling settings, it seems like IIS is restarting my worker process every minute. I can F5 in Task Manager and observe this...once a minute, the worker process restarts with a new PID. I'm using "OutOfProcess" hosting if it matters...has anyone else run into this?
    Arcanox
    @ArcanoxDragon
    stdlogs include an "Application is shutting down..." message every minute if I have them enabled, meaning the process is getting a SIGTERM from IIS, not crashing. I can't figure out what could possibly be causing this
    Arcanox
    @ArcanoxDragon
    ah, it seems to be a Virtual Memory limit on the app pool. I guess the runtime automatically reserves 2 GB (????) of Virtual memory immediately on startup, so it was "hitting" the limit right away. disabling that limit seems to have stopped the once-a-minute restarts (for now)
    sake402
    @sake402
     UIRootWidget UI => new UIRootWidget
            {
                Children =
                {
                    new BannerWidget
                    {
                        Title = SelectedFamily.Descriptor.Name,
                        SubTitle = SelectedFamily.Descriptor.ShortDescription,
                        Description = SelectedFamily.Descriptor.Description,
                        Image = SelectedFamily.Descriptor.BannerImage,
                    },
                    new SectionWidget
                    {
                        Children =
                        {
                            new LayoutRowWidget
                            {
                                Children =
                                {
    
                                   //Error here
                                    SelectedFamily.Descriptor.Features.Select<string, Widget>(f=> new FeatureWidget
                                    {
    
                                    }).ToArray()
                                }
                            }
                        }
                    }
                }
            };
    How do populate a List Initializer from linq.
    Children is a List<Widget> and is protected set
    public class ContainerWidget : Widget
        {
            public List<Widget> Children { get; protected set; } = new List<Widget>();
        }
    Palash Jhabak
    @palashjhabak
    Hi, I am trying to make a http request using HttpClient via a proxy. The proxy has to add a header in the response. But the proxy can only add the header if I make the request http and not https. But somehow HttpClient in the redirection phase from http to https follows the HTTP Connect (tunnel) protocol and not HTTP GET due to which proxy cannot read the headers. It is working absolutely fine in postman. Any way to force HttpClient to not use tunnel protocol ?
    Alok Sharma
    @aloksharma1
    i am trying to invoke view component using vc tag helper but what shoudl be the assembly path for it
    i am using it in areas
    and this is my taghelper path i have defined
    but its not working
    @addTagHelper *, Project.MyModule.Areas.AuthManager.ViewComponents
    that is the folder where view component exists am i doing something wrong
    L Suarez
    @lsuarez5280
    Getting some strange behavior out of my IIS InProcess-hosted Core 3.1 app. OIDC security middleware is calculating the redirect_uri scheme to be HTTP instead of HTTPS. What am I missing to get my app to recognize that it's being requested over SSL?
    Alok Sharma
    @aloksharma1
    @lsuarez5280 whats the middleware code?
    cant you simple check for httpcontext.request.host & path and correct url?
    Ashef Habib Tishad
    @ashtishad
    Suggest me some resources for practicing micro-services concepts. projects based learning is preferable.
    L Suarez
    @lsuarez5280
    @aloksharma1 figured out the cause is our load balancer forwarding requests internally over HTTP. Investigating https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-3.1 now.