Dotnet
- VS Code Interactive Notebook '*-*' is not a valid version string
When installing a NuGet Package in a VS Code Interactive Notebook with a C# (.NET Interactive) code block using the follwing command I copied from this Microsoft tutorial: #r "nuget:Microsoft.DotNet.Interactive.SqlServer, *-*" I recevied the following error: '*-*' is not a valid version string In order to fix this I went and found the latest version number from the NuGet Gallery page for the package and updated the command to include a specific package number instead of the *-*:
- Deploy Dotnet Core Blazor Client Side Static Site to AWS Amplify
I have been playing around with .NET Core and Blazor recently to create a client side application. When it came to deploying the site I thought I would try using something different, in this case it was [Amazon’s Amplify] (https://aws.amazon.com/amplify/) which appears to be Amazon’s answer to Netlify.
- XSRF or CSRF with Angular and Dot Net Core Web API
Turns out adding XSRF, CSRF, See-Surf or whatever the name we call it now to an Angular app with a .NET Core Web API is really really easy. Angular is set up by convention to expect a cookie with the name XSRF-TOKEN.
- How to Add Microsoft's Console Log Provider to .Net Core 2.2 Console Application using the built-in Service Provider
Starting with an empty .NET Core Console Application add the following packages: Microsoft.Extensions.DependencyInjection Microsoft.Extensions.Logging Microsoft.Extensions.Logging.Console Instantiate Microsoft’s Dependecy Injection Service Provider. var serviceProvider = new ServiceCollection().BuildServiceProvider(); Register the Console Logging Provider dependency with the Service Provider using Microsoft’s extension methods var serviceProvider = new ServiceCollection().AddLogging(cfg => cfg.AddConsole()).BuildServiceProvider(); By default the lifetime of the logging service is set to Singleton.
- Quick SSL Certs For Local IIS Development
You can use selfssl from the IIS 6 Resource Kit to quickly add self signed SSL certs for local development. When installing select custom install and only install selfssl.exe. Then you can run the following command: selfssl /N:CN=site.local /V:9999 /T /S:2 CN is the hostname you want to register.
- .NET 5 DNX The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)
When playing around with the new .NET 5 DNX solution I encountered the following error: The type or namespace name ‘List’ could not be found (are you missing a using directive or an assembly reference?) I don’t understand exactly what was causing the error. I think the problem is that my project.json file was not configured correctly. I think that the dnxcore05 didn’t know about system.collections and just adding it to the dependencies didn’t work. Instead I had to add it to the dependencies under the frameworks section of the config like so:
- 'Assembly' does not contain a definition for 'GetExecutingAssembly' ConsoleUI.DNX Core 5.0
When trying to run the following code in a .NET DNX Core 5.0 project: var asm = Assembly.GetExecutingAssembly(); I got the following error: ‘Assembly’ does not contain a definition for ‘GetExecutingAssembly’ ConsoleUI.DNX Core 5.0 For DNX 5.0 projects you have to use the following:
- Visual Studio 2015 - A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Today when opening a project in Visual Studio 2015 I recieved the following error: —————————Microsoft Visual Studio ————————— A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
- NuGet vnext Visual Studio 2015 Error: FindPackagesById:
Today I cloned the aspnet/StaticFiles repository from GitHub on Visual Studio 2015 and when I tried to build the solution I received the following error: Error: FindPackagesById: Microsoft.AspNet.Hosting.Abstractions The problem was that the solution was using packages not available on the main NuGet repo. I was able to fix this problem by going to Tools > NuGet Package Manager > Package Manager Settings > Package Sources and then un-checking all the sources except AspNetVNext https://www.myget.org/F/aspnetvnext/api/v2
- Unable to start debugging on the web server. The underlying connection was closed: An unexpected error occurred on a send.
Today I received the following error when trying to start debugging on a web site in Visual Studio 2013: ————————— Microsoft Visual Studio ————————— Unable to start debugging on the web server. The underlying connection was closed: An unexpected error occurred on a send. Click Help for more information.