Practical .NET, software, and AI tutorials by Gerard Beckerleg, a developer in Sydney.
- Create a self signed certificate with OpenSSL on Windows
First unzip OpenSSL from https://code.google.com/p/openssl-for-windows/downloads/list and put it anywhere you want e.g. c:\openssl. Right click on c:\openssl\bin\openssl.exe and "run as administrator". Enter the following command where c:\openssl is the location you unzipped into: > req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem -config "C:\OpenSSL\openssl.cnf" Country name or any of the other information isnt required so you can keep pressing enter. You should now have two files in the bin folder key.pem and cert.pem.
- Use npm http-server to quickly create a secure web site with host name on Windows
Node and npm makes it really simple to install command line tools. One of my favourites is http-server. Http-server allows you to start a web server from any folder using the command prompt. To do this first install node from https://nodejs.org/en/ this will also install npm. Then open a command prompt and type:
- No default subscription has been designated. Use Select-AzureSubscription -Default to set the default subscription.
When trying to run the Select-AzureSubscription powershell command i recieved the following error even though the subscription name was correct: No default subscription has been designated. Use Select-AzureSubscription -Default to set the default subscription. It turns out that you need to download and update the Azure Publish Settings File before you can do this. The easiest way to do this is to run the following command and follow the prompts:
- .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
- Could not load file or assembly 'Mindscape.Raygun4Net, Version=5.0.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies
After updating nuget packages in a solution I received the following error: Could not load file or assembly ‘Mindscape.Raygun4Net, Version=5.0.2.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies I solved this problem by forcing nuget to reinstall the package using the following command in the Package Manager Console:
- 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.
- Azure Search (search.windows.net) No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore not allowed access. The response had HTTP status code 400.
When using Azure Search you may come across the following error when trying to reach the api No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin is therefore not allowed access. The response had HTTP status code 400 The problem is that search.windows.net will not allow cross origin requests by default and you have to tell it to allow them per index. When creating the index add the following section to your configuration: