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
    did you toyed auth your launchsettings files ?
    because if you messed with it and it does not set ASPNZTCORE_ENVIRONMENT from the profile inside that's why
    check dotnet run -h for launch profile
    nyash
    @nyash

    @tebeco Thanks, Indeed previously (net 5) I would run just dotnet watch run, but now that I have added from your suggestion dotnet watch run --launch-profile ProjectProfile it works fine without any odd exceptions.

    In the file I have just two profiles: "IIS Express" and "ProjectProfile". Looking at the template of MVC from NET6 it is identical.

    TeBeCo
    @tebeco
    iis express was default profile (because first)
    almost nobody ever want to use that ... because it's iis / express
    new template inverted that order
    that said they both should de development on dotnet run or watch
    unless i'm missing something it does not look normal
    can you try on a blank new project create WITH sdk 6 preview 5 and see if that still happen ?
    nyash
    @nyash

    @tebeco Now that you mentioned, it, the launchSettings file had identical content to the one from the template, BUT, the profile order was different (in my own, IIS Express was first).

    I made my ProjectProfile come before IIS Express. dotnet watch rundoes start, but it soon fails whenever I reach some non trivial code, e.g. getting an exception from hibernate: 'NotSupportedException: A non-collectible assembly may not reference a collectible assembly'

    Funnily, if I launch it this way: dotnet watch run --launch-profile ProjectProfile no such thing happens.

    Regarding the NET6 template, it does launch with dotnet watch run, but I can make it crash with a few lines, like by adding:

        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton(x => new MyService()); 
            services.AddRazorPages().AddRazorRuntimeCompilation(); 
        }

    and injecting the service in Index.cshtml HTML:
    @inject MyService service;

    Again, if I launch this within Visual Studio it works.
    or by explicitly stating the launch profile. dotnet watch run --launch-profile WebApplication1

    TeBeCo
    @tebeco
    open an issue on sdk repo
    Michael W Powell
    @mwpowellhtx
    hello, I am looking for a halfway decent primer on identity framework. I do not care about the EF or SQL Server scaffold, in fact, I will drop all that in favor of custom stores. what I need to know are some essentials, what do we store with respect to the framework, identity user? Not the claims identity, correct? Also any built in or custom defined claims. Also allowing for user registration, external identity sources.
    Alberto Passalacqua
    @AlbertoPa
    that's all Identity does, so I'd suggest that info in asp.net core the doc as a starting point
    it is quite informative to take a peek at the table structure
    Michael W Powell
    @mwpowellhtx
    thanks I appreciate that. I'm not sure I care about table structure as I would like to adapt it for use in a document store.
    Alberto Passalacqua
    @AlbertoPa
    I meant the Identity table structure would show you how to store the stuff you asked about (roles, claims, etc)
    and the guide also shows how to deal with custom user data and, if needed, privacy rules (annotating them as [PersonalData], so when the user wants to remove the account they go)
    Michael W Powell
    @mwpowellhtx
    ah I see :eyes: thanks, appreciate the hints
    Alok Sharma
    @aloksharma1
    Hello all, i am having a weird issue with net core identity social login
    my app works fine in localhost but on live production enviornment it gets stucks at
    ttps://mylivesite.com/signin-facebook?code=AQAuapy0T288bv3BUrV8MGqWDmGews16A-XslywLpyrQQHMZgCkDGZU3Ny07c1TBHh01OGUHjbkRYMBy-C0TqRCCm83q5Zgb90hs8aiRpKEQFODSyjI258-ZADyyhSt2xQ7oWssQUrPbX5DD0o1DwvBjqGUf2oj_eDSaIPCOxjt-_OQvqrgVTXiZccqPYggd5JE-9UD5ZUtAWxwNNnr4-pRQfRRi07GmRVlSB9kF3BnhgbhNmn4xtxso-MI61fkJKyVqEY20nMWfw8SVsMfYTMNn5so_PKq6gol_TurdarBBf3lmiHMwIMUDUPKy6dnxhRI&state=CfDJ8L3eiVfkokNJrxwL3HAjpvUAx_8EBSomWq69r3OBAIFGIQEpMnHPHLLcya2U0dUhXc9NnLFC6lvvWXUoI3FX756qkjiWpoiDXoyUzmnmsdHnRNa8KHfVxPZcmk-owvnYjAmXMYOI1XwjmwgMQ4QJrSMcHxMUbKY58EZ-tpSJcZ-k53paimcinpJJtC7ozZrinXTODvpfSl9brHWxK3Ffv81__crxcLrgrfryhFWLzP-7HuvHVR1M2UdwJRpk-IYlmWG6GAQ4C024oVM09lXpQLE
    so basically after this my request just wait indefinitely
    while on local its moving immediately to next method
    both are producing correct oauth response and this is where the problem persists
    i dont know what to do anymore
    tried everything from cookie policy relaxations to disabling anti forgery etc
    alealpha2000
    @alealpha2000
    hello, i need help with something. i want to make a custom JwtSecurityTokenHandler that gets a blacklist of access tokens from a Redis cache. in order to do that that JwtSecurityTokenHandler must get the cache from DI. however AddJwtBearer doesn't pass a IServiceProvider to the callback. how can I get the token handler to get the cache from DI without calling BuildServiceProvider?
    services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
        .AddJwtBearer(opt =>
        {
            opt.SecurityTokenValidators.Clear();
            opt.SecurityTokenValidators.Add(new RevokableJwtSecurityTokenHandler(services.BuildServiceProvider()));
        });
    alealpha2000
    @alealpha2000
    i ended up using a middleware to implement the access token blacklist. the only nasty part was getting the bearer token from the authentication header
    Arnas Kučinskas
    @Arnas-Kucinskas
    ASP.NET MVC by default is protected against XSS? Can you actually screw this part up somehow?
    nyash
    @nyash

    Hi,
    Does anyone know how to log sql statements to stdout for SqlServer: System.Data.SqlClient? For Npgsql/Mysql it is easy:

     NpgsqlLogManager.Provider = new ConsoleLoggingProvider(NpgsqlLogLevel.Debug, true, true); /*postgresql*/
     MySqlConnectorLogManager.Provider = new ConsoleLoggerProvider(MySqlConnectorLogLevel.Debug); /* mysql */

    I can't seem to find an equivalent for System.Data.SqlClient

    Kilian
    @Schtailian

    Hi, i would need some help to find an error.

    I have a windows service which fetches data from a PLC, writes it in a local buffer and then writes it in the main DataBase.

    My task is to make this service as resistent to problems as possible. power outages, broken plc, broken network etc...
    My issues so far were mostly that i could to reestablish the connection to the PLC. Those things i assume to have fixed.

    Now comes the new issue. A power outage occurred the PC was restarted and then the Service threw a System.BadImageFormatException

    How can that be? The application runs fine so it should not be a 32bit/64bit issue.

    Could it be that the dlls are corrupted? Could it be an issue that my service is self contained but there is also another runtime installed on the PC? I have no idea were to start looking, maybe someone had a similar problem.

    In this example it is the Npgsql Assembly, but it does also happen with others.

    Application: Np300.Service.exe
    CoreCLR Version: 5.0.821.31504
    .NET Version: 5.0.8
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.BadImageFormatException: Could not load file or assembly 'Npgsql, Version=5.0.7.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'. Format of the executable (.exe) or library (.dll) is invalid.
    File name: 'Npgsql, Version=5.0.7.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'
       at BasePlcService.Utilities.ConnectionStringGenerator.GenerateDBConnectionString(IConfiguration configuration)
       at Np300.Service.Program.<>c__DisplayClass2_0.<ConfigureServices>b__1(DbContextOptionsBuilder options) in /builds/rubnergroup/np/machineservices/np300/Np300.Service/Program.cs:line 36
       at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.<>c__DisplayClass1_0`2.<AddDbContext>b__0(IServiceProvider p, DbContextOptionsBuilder b)
       at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.CreateDbContextOptions[TContext](IServiceProvider applicationServiceProvider, Action`2 optionsAction)
       at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.<>c__DisplayClass17_0`1.<AddCoreServices>b__0(IServiceProvider p)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSite
    ...
    TeBeCo
    @tebeco
    @nyash you probably should drop System.xxxx for Microsoft.xxxx if you don’t hit current limitation
    @Schtailian it could be 32/64 but it’s not because the process start that the dll is loaded but rather when it’s gonna be detected as needed
    example, if npgsql is only 64bit and you hablebdefault platform with is AnyCPU it’s gonna do that
    because AnyCPU will not “transform the code to run either 64/32bits”
    it will spit code that is supposed to run on anycpu
    which is mostly 32bits then because 32 run on 64 with WoW
    (and yeah now there’s ARM and ARM64 but i have no clue on it impact on AnyCPU, like if there’s breaking change it’s likely not to change for backward compat)
    TeBeCo
    @tebeco
    i can suggest you to join both discord “C#” (community driven for help) and “DotNetEvolution” (msft control driven for actual question on project/product) where you’ll find way more activity / people
    there’s channel for advanced/roslyn/low level/runtime where there’s member of the .net team to provide answer
    FloteFuertes
    @FloteFuertes
    Hi my boss wants our api and web app to be Hipaa compliant is using the .net framework 3.5 and above and ssl is not using encryption or secure the web app? I’ve read that 4.5 framework is using the TLs 1.2. How to make this encryption thing? Thanks in advance
    TeBeCo
    @tebeco
    no magic here you’ll have to google up HIPAA and check point one by one and fix if you need
    FloteFuertes
    @FloteFuertes
    Thanks TeBeco not sure what to fixed on our app since it was running ok and also it runs under ssl and with Tls but will give that one a try.Thanks
    TeBeCo
    @tebeco
    i can’t help about HIPAA at all that’s why i said you probably need to either read it all yourself or ask someone that know about it
    regarding TLS on 3.5 it’s another beast
    it will also depends on the OS since a part of it is delegated to it
    2nd result is
    FloteFuertes
    @FloteFuertes
    No problem. The link helps a lot thanks
    TeBeCo
    @tebeco
    “Support for TLS System Default Versions included in the .NET Framework 3.5 on Windows 8.1 and Windows Server 2012 R2”