NET 5 – Fix – System.InvalidOperationException: ‘Application is running inside IIS process but is not configured to use IIS server.’

 

After updating a .NET Core 2.2 app to NET 5, the following error appeared:

System.InvalidOperationException: ‘Application is running inside IIS process but is not configured to use IIS server.’

 

To fix this use HotBuilder instead of WebHostBuilder

 

public class Program

{


    private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program));

 

    public static void Main(string[] args)


    {


        CreateHostBuilder(args).Build().Run();


    }

 

    public static IHostBuilder CreateHostBuilder(string[] args) =>


        Host.CreateDefaultBuilder(args)


            .ConfigureWebHostDefaults(webBuilder =>


            {


                webBuilder


                .UseKestrel(serverOptions => serverOptions.AddServerHeader = false)


                .UseIISIntegration()


                .UseStartup<Startup>();


            });


}

 

NET 5 – Fix – ‘IConfigurationSection’ does not contain a definition for ‘Get’ and no accessible extension method ‘Get’ accepting a first argument of type ‘IConfigurationSection’ could be found (are you missing a using directive or an assembly reference?)

 

‘IConfigurationSection’ does not contain a definition for ‘Get’ and no accessible extension method ‘Get’ accepting a first argument of type ‘IConfigurationSection’ could be found (are you missing a using directive or an assembly reference?)

 

https://stackoverflow.com/questions/45039136/bind-an-iconfigurationsection-to-a-complex-object-without-asp-net-core

 

Install the package

 

 

NET 5 – Fix – ‘IServiceCollection’ does not contain a definition for ‘AddSpaStaticFiles’

 

After updating an app to NET 5, I was facing the following error:

‘IServiceCollection’ does not contain a definition for ‘AddSpaStaticFiles’ and no accessible extension method ‘AddSpaStaticFiles’ accepting a first argument of type ‘IServiceCollection’ could be found (are you missing a using directive or an assembly reference?)

 

Fixed this by installing 2 new packages:

 

 

https://stackoverflow.com/questions/53253526/iservicecollection-does-not-contain-a-definition-for-addspastaticfiles

 

Node-sass – fix – gyp verb check python checking for Python executable “python2” in the PATH

 

node-sass – gyp verb check python checking for Python executable “python2” in the PATH

 

Fix: https://stackoverflow.com/questions/45801457/node-js-python-not-found-exception-due-to-node-sass-and-node-gyp

delete node_modulesfolder

running npm install –global windows-build-tools

reinstalling node modules or node-sass with npm install

 

 

NVM not using correct node version – nvm use not working on Windows 10

 

Cause, I had a manual installation of node on my Windows 10 machine and also a NVM installation

Solution

Remove node: “Add or Remove programs”

Remove cache:

C:\Users\xxx\AppData\Roaming\npm

C:\Users\xxx\AppData\Roaming\npm-cache

C:\Program Files\nodejs

 

Remove all node version in nvm:

nvm list

nvm uninstall x.x.x

nvm uninstall x.x.x

nvm uninstall x.x.x

 

Manualy remove folders in “C:\ProgramData\nvm”

 

Install desired node version:

nvm install 15.11.0

nvm use 15.11.0

GitLab – FastLane – bundle– Apple M1 – Error no locale UTF-8

 

When executing bundle exec fastlane env, I was getting an error indicating a supported UTF-8 locale could not be found.

Fixed this by following “Set up environment variables” on https://docs.fastlane.tools/getting-started/ios/setup/

Add

export LC_ALL=en_US.UTF-8

export LANG=en_US.UTF-8

To ~/.zshrc

You can find your shell profile at ~/.bashrc, ~/.bash_profile, ~/.profile or ~/.zshrc depending on your system.

 

 

 

GitLab – FastLane – Apple M1 – How to fix: Permission denied @ rb_sysopen – /Users/roelvanlisdonk/Library/MobileDevice/Provisioning Profiles/1111111-111-1111-1111-111111111.mobileprovision

 

When executing “bundle exec fastlane mylane”, I was getting the error:

Permission denied @ rb_sysopen – /Users/roelvanlisdonk/Library/MobileDevice/Provisioning Profiles/1111111-111-1111-1111-111111111.mobileprovision

 

Solution

Change folder permissions:

sudo chown -R $(whoami) “/Users/roelvanlisdonk/Library/MobileDevice/Provisioning Profiles/12c0f4c3-8219-4c47-b204-65d77a05ece4.mobileprovision”