How do you run .net core during deployment / after publishing it.

You must be thinking it is dotnet run?  Nope.

The actual answer is dotnet xxxxxx-your-service.dll name

I know it's kinda stupid but sometimes i get it wrong.

choclatey supports .netcore installation

Yay! This is really good.

Choclatey supports .net core installation.To get started just use the following command.

choco install dotnetcore-sdk

EF Core :- Getting request using dbcontext from stored procedure that returns "SELECT"

Let's say i have the following stored procedure, which return results using "SELECT" instead of RETURN.

I use the following codes to get results from my stored procedure :-

If you're trying to get value from a stored procedure which give back result using "return", you can use this piece of code.

That's it! :)

What : ExecuteSqlCommand not found in EF core?

If you get this, all you need is, LOL ...

using Microsoft.EntityFrameworkCore;

Scaffold-DbContext build failed

If you're getting build failed running "Scaffold-DbContext" (as shown below)

Then you need to ensure that your entire project build successfully. Not just the project that you're working on.

Once you have your project errors all fixed, continue running the scaffold command. core error to "could not find file or assembly with custom assembly"

If your .net core project throws an exception saying "could not find file or assembly. File not found". Even though you have added it into the project. To fix this, convert your class .dll into a nuget package.

A pix worth a thousands words! :) core self hosted application not running

When you run your application, particularly the startup.cs, and if you faces problem hitting into methods such as

a) public void ConfigureServices(IServiceCollection services)

Then what you can do is try to go to command line and run "dot net run" to see if you have any exception on the console. Possible reason could be exception trying to load certain dll file that is not there.

Kurbenetes : Retrying. E0611 12:40:36.428003 9060 start.go:133] Error starting host: Error getting state for host: machine does not exist

I face this issue running minikube on Window on my J drive. When i switch it to c drive things seems to be working fine.

webapi streaming

If you need to stream a video from webapi, you can use the following codes. The code is taken from stackvoerflow. I did not write it.

If you're using .net core, use the following code.

There are loads of sample in the internet, but i think this works well for .net 4.6.

You probably need to know that if you not sure exact size of your files, try PushStreamContent.
Otherwise, you can just use StreamContent.

HttpStatusCode Details.....

        // Summary:
        //     Equivalent to HTTP status 100. System.Net.HttpStatusCode.Continue indicates that
        //     the client can continue with its request.
        Continue = 100,
        // Summary:
        //     Equivalent to HTTP status 101. System.Net.HttpStatusCode.SwitchingProtocols indicates
        //     that the protocol version or protocol is being changed.
        SwitchingProtocols = 101,
        // Summary:
        //     Equivalent to HTTP status 200. System.Net.HttpStatusCode.OK indicates that the
        //     request succeeded and that the requested information is in the response. This
        //     is the most common status code to receive.
        OK = 200,
        // Summary:
        //     Equivalent to HTTP status 201. System.Net.HttpStatusCode.Created indicates that
        //     the request resulted in a new resource created before the response was sent.
        Created = 201,

differences between dotnet pack vs dotnet publish

dotnet publish build and ensure your application is ready for deployment and ready for runtime - it comes with all the necessary dll, project dependencies.

dotnet pack on the other hand, ensure that you application is build as a nuget package and allows your users to pull down only this .dll. Nuget will resolves dependencies but only your dll is packaged and distributed.