Artis Vilciņš
Artis Vilciņš
CC#
Created by Richard on 1/3/2024 in #help
I am trying to host .NET8 application in IISExpress but facing error.
I have tried doing this and the longer I tried any reasonable advice I can give you is do not do this. Forget IIS even exists. Use Kestrel and/or deploy using docker. After this had even more issues trying to deploy it when using libraries with other conflicting libraries and in the end not worth it.
4 replies
CC#
Created by MC_2018 on 12/29/2023 in #help
DbContext with IServiceProvider: whether or not to have a using statement
I would leave that to service provider, but I would create a scope before using it and use it inside the operational scope and then discard of the scope. approximate example: using var scope = Program.ServiceProvider.CreateScope(); var context = scope.ServiceProvider.GetRequiredService<ShuffullContext>(); // do some work using context and other services I do not know if you have requirements for parallel working, but 1 context instance can not be used in parallel. That is the reason why context class should be scoped and created per usage true scoped context and not used inside root scope (as singleton). When created scope is disposed it should dispose of correctly any classes it created, so you do not need add using when requiring context.
3 replies