The new version of dotnet core cannot handle the HttpContext in the MVC model.
An unhandled exception has occurred while executing the request. System.InvalidOperationException: Could not create an instance of type ‘Microsoft.AspNetCore.Http.HttpContext’. Model bound complex types must not be abstract or value types and must have a parameterless constructor. Alternatively, set the ‘HttpContext’ property to a non-null value in the ‘…’ constructor.
The Cities: Skylines game does not have a usual undo function, but by pressing the F1 key we can save the current state into a “Quick Save” file before a change.
To load the state from the Quick Save file, select it in the list of the Load Game menu item
When a provider has been updated outside of Terraform, (for example in Terraformer) Terraform can get out of sync with that provider version. terraform init works, but terraform plan throws the error message:
Error: Failed to instantiate provider “aws” to obtain schema: Incompatible API version with plugin. Plugin version: 4, Client versions: [5]
To update Terraform to be able to use the new provider execute
The Cities: Skylines game keeps objects in memory even if the object is not used. Even a 16GB system can crash frequently if the memory usage is not managed.
“Oops! The game crashed
The memory usage is high, even when the map is not too complex.
Enable enough Virtual Memory
Make sure Windows has enough Virtual Memory configured. I have set up 4096 MB minimum and maximum Virtual Memory for my 16 GB Toshiba laptop.
Download the sample “skip.txt” file from https://thale5.github.io/Prefabs/ and save it at C:\Users\YOUR_USER_NAME\AppData\Local\Colossal Order\Cities_Skylines\SkippedPrefabs\skip.txt
Start the Cities: Skylines game and select CONTENT MANAGER
On the left side select MODS
Enable the mod. We will be able to set the options when the mod already ran once.
Accept the disclaimer
Close the MODS page
Start the game to be able to set the options later
Quit the game
Exit to the Main Menu
Open the MODS page
Click the OPTIONS button
Select the Skip the prefabs named in this file option
When the game starts the Loading Screen mod will display the memory usage
After a few minutes, the memory usage will go down to 25% of the prior value or less.
To run Windows Docker containers on your Macintosh computer, use the following setup. This will introduce a performance hit, because you run virtualization in virtualization.
Besides the usual setup process, you need to enable hypervisor applications to avoid the error
Error response from daemon: container … encountered an error during CreateContainer: failure in a Windows system call: No hypervisor is present on this system
Install VMware Fusion on your MacBook Pro
Create a Windows 10 virtual machine
Open the Settings of the Windows 10 virtual machine
Select Processors & Memory
In the Advanced region check Enable hypervisor applications in this virtual machine
The dotnet core MVC web application template adds the GDPR cookie acceptance message to the header of the page template. When the site is hosted with HTTP the accept button does not clear the message resulting an infinite loop, when the user cannot log in and the site continuously asks for the acceptance.
When the site is hosted in a Docker container it is also simpler to instal the SSL certificate on the load balancer and host the site with HTTP on port 80.
We use cookies. To be able to use this site please click the Accept button.
To remove the feature delete the
<partial name="_CookieConsentPartial" />
line from the Views\Shared\Layout.cshtml file.
Without the acknowledgement the dotnet core framework will not save any non essential cookies in the browser, so the session state will stop working.
To tell the dotnet core framework, that the application does not require the user to allow the saving of the cookies set the value of CheckConsentNeeded to false in the ConfigureServices() method, services.Configure<CookiePolicyOptions> { section
options.CheckConsentNeeded = context => false;
To make sure the session cookie is always saved even if the GDPR confirmation is enabled, declare it to essential in the ConfigureServices() method, services.AddSession(options => { section
It is not good practice to store secrets in the source code repository. The sample C# dotnet core application code stores the database connection string in the appsettings.json file which eventually will be pushed into GitHub. To follow the Twelve-Factor App methodology, store the configuration values in environment variables and load them runtime. This method enables your application to run in a Docker container and in a Kubernetes pod.
If the connection string is not specified, we get the error message
System.ArgumentNullException: ‘Value cannot be null. Parameter name: connectionString’
To read the connection string from an environment variable
Add the builders to the Startup.cs file
public Startup(IConfiguration configuration, IHostingEnvironment env)
{
Configuration = configuration;
Env = env;
// Read the connection string from the "ASPNETCORE_ConnectionStrings:DefaultConnection" environment variable
// RESTART Visual Studio if you add or edit environment variables for the change to take effect.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
// This one needs to be last for the environment variables to have the highest priority
builder.AddEnvironmentVariables("ASPNETCORE_");
Configuration = builder.Build();
}
Create the ASPNETCORE_ConnectionStrings__DefaultConnection environment variable. The double underscore will be converted to a colon ( : ) . This variable name works on Windows, and also in Linux where the environment variable name cannot contain colons.
IMPORTANT: If you add or change an environment variable, restart Visual Studio for the change to take effect. It is not enough to restart the application.
docker: Error response from daemon: error while mounting volume ‘/var/lib/docker/volumes/…/_data’: failed to mount local volume: mount :/data:/var/lib/docker/volumes/…/_data, data: addr=…,vers=4: operation not permitted.
or
docker: Error response from daemon: error while mounting volume ‘/var/lib/docker/volumes/…/_data’: failed to mount local volume: mount :/data:/var/lib/docker/volumes/…/_data, data: addr=…,vers=4: connection refused.
To be able to mount the volume from macOS, use the insecure option in /etc/exports