Category: .NET Core

.NET Core 3.0 to .NET Core 3.1 and .NET Core SSL (https )with VSCode + Docker –part 44

To pass from .NET Core 3.0 to .NET Core 3.1

  1. Modify the .csproj
  2. Modify the devops
    • Modify the GitHub Actions
    • Modify the Azure Devops ( because was on Docker , just modify the docker FROM sdk
  3. Modify the dockerfile in the  .devcontainer folder to run in VSCode Container

Some of the modifications here : https://github.com/ignatandrei/InfoValutar/commit/2d5b138ccd6225a6bf69dca47fe76e2270920d2d

However, to have running in Docker container with SSL it is much more difficult. The instruction were here 

https://github.com/microsoft/vscode-dev-containers/blob/master/containers/dotnetcore-3.0/.devcontainer/devcontainer.json

However, some of them implied sharing local pfx , others implies modifying the dockerfile.

And the fact that I should be rebuild the container does not help …as time goes by.

If you look at

https://github.com/ignatandrei/InfoValutar/commit/c371e67aea3a283d3b8c208eec168c795f6fe680

you can see what is necessary that now I have for InfoValutar both .NET Core WebAPI and Angular WebSite running in VS Code on Docker containers.

Infovalutar

And one hour passes...
(This is the result of 1 hour per day auto-challenge as a full cycle developer for an exchange rates application)
( You can see the sources at https://github.com/ignatandrei/InfoValutar/ )
NrPost 
1Start
2Reading NBR from internet
3Source control and build
4Badge and test
5CI and action
6Artifacts and dotnet try
7Docker with .NET Try
8ECB
9Intermezzo - Various implementations for programmers
10Intermezzo - similar code - options
11Plugin implementation
12GUI for console
13WebAPI
14Plugin in .NET Core 3
15Build and Versioning
16Add swagger
17Docker - first part
18Docker - second part
19Docker - build Azure
20Pipeline send to Docker Hub
21Play with Docker - online
22Run VSCode and Docker
23Deploy Azure
24VSCode see tests and powershell
25Code Coverage
26Database in Azure
27Sql In Memory or Azure
28Azure ConString, RSS
29Middleware for backward compatibility
30Identical Tables in EFCore
31Multiple Data in EFCore
32Dot net try again
33Start Azure Function
34Azure function - deploy
35Solving my problems
36IAsyncEnumerable transformed to IEnumerable and making Azure Functions works
37Azure functions - final
38Review of 37 hours
39Last Commit in AzureDevOps
40Create Angular WebSite
41Add static Angular to WebAPI .NET Core
42Docker for Angular
43Angular and CORS
44SSL , VSCode, Docker
45Routing in Angular
46RxJS for Routing
47RxJs Unsubscribe

Configure Angular Environment(local and remote) and CORS for .NET Core – part 43

I want to be capable to run Angular with data obtained from local .NET project in development – and from remote website in production. One of the techniques is detailed here

https://angular.io/guide/build

Generated service :

ng g s banks

Now I want to see that every modification of the Bankservice will re-compile. Tried in Docker to run

ng serve –host 0.0.0.0  –poll 200

but it does not show modifications of files changing.

The problem is that not show the files changing generated inside. Time to re-build the docker container for angular

docker container prune -f

docker images “vs*”

docker image rm <id of the prev image>

No modification. The problem was: the BankService was not referenced yet! If I refeerence to the BankComponent, the poll works!

Now let’s see if the Angular Web can access .NET Core WebAPI – no. I forgot to add CORS:

public void ConfigureServices(IServiceCollection services)
{
     services.AddCors(options =>
     {
         options.AddPolicy(“AllowedAll”,
         builder =>
         {
             builder
                 .AllowAnyHeader()
                 .AllowAnyOrigin()
                 .AllowAnyMethod();
         });

    });

// code

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{

    if (env.IsDevelopment())
     {
         app.UseDeveloperExceptionPage();
     }

    app.UseCors(“AllowedAll”);

and now it works – I can see in Angular Web App the banks.

The modifications are in

https://github.com/ignatandrei/InfoValutar/commit/2106328935b972a4411f5412ba3fc810a46399b8

Adding Angular to WebAPI site-part 41

First, I want to add an index.html file – to see the result.

For this, I add to the startup:

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
         //more code
app.UseDefaultFiles();
app.UseStaticFiles();

I also add an index.html into a wwwroot folder ( also created into the root)

You can see the modifications here: https://github.com/ignatandrei/InfoValutar/commit/4deb32528aee7b667f22a38c8e96899052cbfd4c

Now I want to compile the Angular application and add the index html generated by Angular to the wwwroot site

I create a powershell ( easy for me , because you can install dotnet tool powershell )

echo “starting build angular”
cd InfovalutarWebAng
npm i
ng build  –prod –build-optimizer
cd ..

$source= “InfovalutarWebAng/dist/InfovalutarWebAng/”
$dest= “InfoValutarWebAPI/wwwroot/”
echo “delete files”
Get-ChildItem -Path $dest -Include *.* -File -Recurse | foreach { $_.Delete()}
echo “copy files”
Get-ChildItem -Path $source | Copy-Item -Destination $dest

and put in Azure Devops pipelines

 
– powershell: |
       cd InfoValutar
       .\copyAng.ps1
   displayName: copy angular site to web api

Now commit in GitHub (https://github.com/ignatandrei/InfoValutar/comAmit/5208036a4cb1da719692966880236dc33b1b2e74 )and waiting to see if it works

The error is : “The term ‘ng’ is not recognized as the name of a cmdlet, function, script file, or

The term ‘ng’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the

spelling of the name, or if a path was included, verify that the path is correct and try again.

Adding

npm i -g @angular/cli

It works!

Last Commit info–GitHub and AzureDevOps–part 39

I was thinking that I need to see the date of last CD – who done what. For this, I need 2 things: to have a controller/gui to show the info and the CD process, via GitHub/AzureDevOps  ,to take care of that.

For the part with code, the problem was pretty simple:

 

using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace InfoValutarWebAPI.Controllers
{
    /// <summary>
    /// info about commit
    /// </summary>
    public class LastCommitInfo
    {
        /// <summary>
        /// comment latest commit
        /// </summary>
        public string LatestCommit { get; set; }
        /// <summary>
        /// last date of commit
        /// </summary>
        public DateTime DateCommit { get; set; }
        /// <summary>
        /// last author of commit
        /// </summary>
        public string LastAuthor { get; set; }
    }
    /// <summary>
    /// controller about info the application
    /// </summary>
    [ApiController]
    [ApiVersion("1.0")]
    [Route("api/v{version:apiVersion}/rates")]
    public class InfoController
    {
        /// <summary>
        /// info about latest commit
        /// </summary>
        /// <returns></returns>
        public LastCommitInfo GetLatestCommit()
        {
            return
                new LastCommitInfo()
                {
                    LatestCommit = "{LatestCommit}",
                    DateCommit = DateTime.ParseExact("{DateCommit}", "yyyyMMdd:HHmmss", null),
                    LastAuthor = "{LastAuthor}"
                }
                ;
        }
    }
}

 

What about the CD process ?

Well, this was cumbersome. To see ALL the environment  variables, I used cmd /K set ( in command ) or Get-ChildItem Env: ( in powershell).

And I come with this:

A bash script to take the version

– bash: |

git log –format=’%s’ -1

git log –pretty=oneline | head -1

gitMessage=$(git log –format=’%s’ -1)

echo “##vso[task.setvariable variable=commitMessage;isOutput=true]$gitMessage”

displayName: Store commit message in variable

– powershell: .\modifyinfo.ps1

displayName: modify info

 

And a  .ps1 powershell

$file = “.\InfoValutar\InfoValutarWebAPI\Controllers\InfoController.cs”

$date = Get-Date -Format “yyyyMMdd:HHmmss”

Get-ChildItem Env:

$author= $Env:BUILD_SOURCEVERSIONAUTHOR

$commitText = $env:BASH_COMMITMESSAGE

((Get-Content -path $file -Raw) -replace ‘{LatestCommit}’,$commitText -replace ‘{LastAuthor}’,$author -replace ‘{DateCommit}’ , $date ) | Set-Content -Path $file

(Get-Content -path $file -Raw)

The result can be seen at  https://infovalutar.azurewebsites.net/api/v1.0/info

Infovalutar

And one hour passes...
(This is the result of 1 hour per day auto-challenge as a full cycle developer for an exchange rates application)
( You can see the sources at https://github.com/ignatandrei/InfoValutar/ )
NrPost 
1Start
2Reading NBR from internet
3Source control and build
4Badge and test
5CI and action
6Artifacts and dotnet try
7Docker with .NET Try
8ECB
9Intermezzo - Various implementations for programmers
10Intermezzo - similar code - options
11Plugin implementation
12GUI for console
13WebAPI
14Plugin in .NET Core 3
15Build and Versioning
16Add swagger
17Docker - first part
18Docker - second part
19Docker - build Azure
20Pipeline send to Docker Hub
21Play with Docker - online
22Run VSCode and Docker
23Deploy Azure
24VSCode see tests and powershell
25Code Coverage
26Database in Azure
27Sql In Memory or Azure
28Azure ConString, RSS
29Middleware for backward compatibility
30Identical Tables in EFCore
31Multiple Data in EFCore
32Dot net try again
33Start Azure Function
34Azure function - deploy
35Solving my problems
36IAsyncEnumerable transformed to IEnumerable and making Azure Functions works
37Azure functions - final
38Review of 37 hours
39Last Commit in AzureDevOps
40Create Angular WebSite
41Add static Angular to WebAPI .NET Core
42Docker for Angular
43Angular and CORS
44SSL , VSCode, Docker
45Routing in Angular
46RxJS for Routing
47RxJs Unsubscribe

Exchange rates–what I have done in 37 hours–part 38

What I have create for now in 37 hours :

  1. A source control – https://github.com/ignatandrei/InfoValutar
  2. A plugin based software – you can use to load any kind of exchange rates, for anywhere , provided that you implement the interface – see implementation
  3. Tests for some of the code
  4. Deployment:
  5. A SqlServer database – to store datas
  6. An Azure Function  – https://azurefuncloaddata20191205080713.azurewebsites.net/ –  to load data at time based cron intervals
  7. A GitHub action to compile ,run tests , – https://github.com/ignatandrei/InfoValutar/actions
  8. An AzureDevops CI + CD  to do all 1-6 things +code coverage + deploy https://dev.azure.com/ignatandrei0674/InfoValutar/_build?definitionId=5&_a=summary

 

I did say it is a nice work for 37 hours of work, right ?

Infovalutar

And one hour passes...
(This is the result of 1 hour per day auto-challenge as a full cycle developer for an exchange rates application)
( You can see the sources at https://github.com/ignatandrei/InfoValutar/ )
NrPost 
1Start
2Reading NBR from internet
3Source control and build
4Badge and test
5CI and action
6Artifacts and dotnet try
7Docker with .NET Try
8ECB
9Intermezzo - Various implementations for programmers
10Intermezzo - similar code - options
11Plugin implementation
12GUI for console
13WebAPI
14Plugin in .NET Core 3
15Build and Versioning
16Add swagger
17Docker - first part
18Docker - second part
19Docker - build Azure
20Pipeline send to Docker Hub
21Play with Docker - online
22Run VSCode and Docker
23Deploy Azure
24VSCode see tests and powershell
25Code Coverage
26Database in Azure
27Sql In Memory or Azure
28Azure ConString, RSS
29Middleware for backward compatibility
30Identical Tables in EFCore
31Multiple Data in EFCore
32Dot net try again
33Start Azure Function
34Azure function - deploy
35Solving my problems
36IAsyncEnumerable transformed to IEnumerable and making Azure Functions works
37Azure functions - final
38Review of 37 hours
39Last Commit in AzureDevOps
40Create Angular WebSite
41Add static Angular to WebAPI .NET Core
42Docker for Angular
43Angular and CORS
44SSL , VSCode, Docker
45Routing in Angular
46RxJS for Routing
47RxJs Unsubscribe

Azure functions – final–part 37

So , I said, now just retrieve data – and put on database:

try
             {
                 log.Info(“trying to save”);
                 ISave save = new SaveSqlServer(null);
                 await save.Save(data.ToArray());
             }
             catch(Exception ex)
             {
                 log.Error($”ERROR !! {ex.Message}”);
             }

This gives me a new whole error:

ERROR !! Could not load type ‘System.IAsyncDisposable’ from assembly ‘netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’.

Ok. Coming from start: What I want ? To save recent data into the database and checking at regular times. How to do that ? Simple . Just call https://infovalutar.azurewebsites.net/api/v1.0/save/LoadAndSaveAll

Good. So this should be the code:

log.Info($”LOAD from website: {DateTime.Now}”);
             Console.WriteLine(“————————!!”);
             var url = “https://infovalutar.azurewebsites.net/api/v1.0/save/LoadAndSaveAll”;
             var http = new HttpClient();
             var data = await http.GetStringAsync(url);
             log.Info($”obtaining data {data}”);

And … it works flawless! – For BNR – for ECB it shows just a record. That is somehow strange – the coding was almost the same

Now it is time to wrote some more tests  -and to find if ECB is loading more than 1 record. Yes, it is.

Then the problem is when saving? Or when loading ?

I have the result of saving :

public class ResultsLoadBankData
     {
         public string Bank { get; internal set; }
         public int NrRecords { get; internal set; }
         public bool HasSuccess { get; internal set; }
         public string ErrorMessage { get; internal set; }
     }

And I modified to this

public class ResultsLoadBankData
     {
         public string Bank { get; internal set; }
         public int NrRecordsLoaded { get; internal set; }
         public int NrRecordsSaved { get; internal set; }

        public bool HasSuccess { get; internal set; }
         public string ErrorMessage { get; internal set; }
     }

Also , there were many other small modifications when loading data.

Infovalutar

And one hour passes...
(This is the result of 1 hour per day auto-challenge as a full cycle developer for an exchange rates application)
( You can see the sources at https://github.com/ignatandrei/InfoValutar/ )
NrPost 
1Start
2Reading NBR from internet
3Source control and build
4Badge and test
5CI and action
6Artifacts and dotnet try
7Docker with .NET Try
8ECB
9Intermezzo - Various implementations for programmers
10Intermezzo - similar code - options
11Plugin implementation
12GUI for console
13WebAPI
14Plugin in .NET Core 3
15Build and Versioning
16Add swagger
17Docker - first part
18Docker - second part
19Docker - build Azure
20Pipeline send to Docker Hub
21Play with Docker - online
22Run VSCode and Docker
23Deploy Azure
24VSCode see tests and powershell
25Code Coverage
26Database in Azure
27Sql In Memory or Azure
28Azure ConString, RSS
29Middleware for backward compatibility
30Identical Tables in EFCore
31Multiple Data in EFCore
32Dot net try again
33Start Azure Function
34Azure function - deploy
35Solving my problems
36IAsyncEnumerable transformed to IEnumerable and making Azure Functions works
37Azure functions - final
38Review of 37 hours
39Last Commit in AzureDevOps
40Create Angular WebSite
41Add static Angular to WebAPI .NET Core
42Docker for Angular
43Angular and CORS
44SSL , VSCode, Docker
45Routing in Angular
46RxJS for Routing
47RxJs Unsubscribe

IAsyncEnumerable transformed to IEnumerable and making Azure Functions works- part 36

Last time I have had problems because of IAsyncEnumerable not be loaded from SystemRuntime. Decided to modify code to use instead Task<Ienumerable>

The code modifications were interesting

await foreach (var e in nbr.GetActualRates())

//versus
  foreach (var e in await nbr.GetActualRates())

yield return exch;

//versus adding to a list and return the list
  ret.Add(exch);

var data = await nbr.GetActualRates().ToArrayAsync();

//versus

var data = (await nbr.GetActualRates()).ToArray();

All in all, not so difficult.Code changes at https://github.com/ignatandrei/InfoValutar/commit/d2744dd0cc194c6e63c7efc2f262ec1b233bde7c

To test in production, it does not help that AzureDevops is taking 7 minutes. Trying in the meantime to setup AzureDevOps on my PC.

In Azure Function – the same error occurred.

Ok . Now trying to see if something smaller can be possible. Rather to load every plugin to give information, maybe I can load just the plugins directly.

Cannot bind parameter ‘log’ to type ILogger

Apparently, a known issue for package hell . Reading

https://docs.microsoft.com/en-us/sandbox/functions-recipes/logging?tabs=csharp

Commuting to TtraceWriter

Now deployng from Visual Studio =>error: System.IO.FileNotFoundException: Could not load file or assembly ‘netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’

Re-doing via CI – AzureDevOps : WORKS!

Infovalutar

And one hour passes...
(This is the result of 1 hour per day auto-challenge as a full cycle developer for an exchange rates application)
( You can see the sources at https://github.com/ignatandrei/InfoValutar/ )
NrPost 
1Start
2Reading NBR from internet
3Source control and build
4Badge and test
5CI and action
6Artifacts and dotnet try
7Docker with .NET Try
8ECB
9Intermezzo - Various implementations for programmers
10Intermezzo - similar code - options
11Plugin implementation
12GUI for console
13WebAPI
14Plugin in .NET Core 3
15Build and Versioning
16Add swagger
17Docker - first part
18Docker - second part
19Docker - build Azure
20Pipeline send to Docker Hub
21Play with Docker - online
22Run VSCode and Docker
23Deploy Azure
24VSCode see tests and powershell
25Code Coverage
26Database in Azure
27Sql In Memory or Azure
28Azure ConString, RSS
29Middleware for backward compatibility
30Identical Tables in EFCore
31Multiple Data in EFCore
32Dot net try again
33Start Azure Function
34Azure function - deploy
35Solving my problems
36IAsyncEnumerable transformed to IEnumerable and making Azure Functions works
37Azure functions - final
38Review of 37 hours
39Last Commit in AzureDevOps
40Create Angular WebSite
41Add static Angular to WebAPI .NET Core
42Docker for Angular
43Angular and CORS
44SSL , VSCode, Docker
45Routing in Angular
46RxJS for Routing
47RxJs Unsubscribe

Azure function–solving my own code problems–part 35

1. My fault – the plugins does not exists in output

this should be added to the output in order to the plugins to be copied to the output directory

<ItemGroup>
<None Remove=”plugins\” />
<Content Include=”plugins\**\*.dll” CopyToOutputDirectory=”Always” />
</ItemGroup>

2. Deploying  , I should see what it is convenient: context.FunctionDirectory  OR context.FunctionAppDirectory

log.LogInformation($”!!! C# Timer trigger function executed at: {DateTime.Now} next {myTimer.FormatNextOccurrences(1)} “);
var folder = Path.Combine(context.FunctionDirectory, “plugins”);
log.LogInformation($”!!! Folder {folder} Folder exists: {Directory.Exists(folder)}”);

folder = Path.Combine(context.FunctionAppDirectory, “plugins”);
log.LogInformation($”!!!Folder {folder} Folder exists: {Directory.Exists(folder)}”);

3. Plugins loading – missing dll’s

Because I work with Nate Mc Master Plugins  , https://github.com/natemcmaster/DotNetCorePlugins, I encounter the  error “ could not load file or assembly ‘System.Runtime.Loader, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

I was trying self-contained in building Azure  – does not publish the file ‘System.Runtime.Loader . But the InfoValutarLoadingLibs/InfoValutarLoadingLibs.csproj it does!

Solution : publish self contained loading libs, build azure function , copy files from loading libs to azure function project

4. Now encountering this one:

https://github.com/Azure/Azure-Functions/issues/1250

Infovalutar

And one hour passes...
(This is the result of 1 hour per day auto-challenge as a full cycle developer for an exchange rates application)
( You can see the sources at https://github.com/ignatandrei/InfoValutar/ )
NrPost 
1Start
2Reading NBR from internet
3Source control and build
4Badge and test
5CI and action
6Artifacts and dotnet try
7Docker with .NET Try
8ECB
9Intermezzo - Various implementations for programmers
10Intermezzo - similar code - options
11Plugin implementation
12GUI for console
13WebAPI
14Plugin in .NET Core 3
15Build and Versioning
16Add swagger
17Docker - first part
18Docker - second part
19Docker - build Azure
20Pipeline send to Docker Hub
21Play with Docker - online
22Run VSCode and Docker
23Deploy Azure
24VSCode see tests and powershell
25Code Coverage
26Database in Azure
27Sql In Memory or Azure
28Azure ConString, RSS
29Middleware for backward compatibility
30Identical Tables in EFCore
31Multiple Data in EFCore
32Dot net try again
33Start Azure Function
34Azure function - deploy
35Solving my problems
36IAsyncEnumerable transformed to IEnumerable and making Azure Functions works
37Azure functions - final
38Review of 37 hours
39Last Commit in AzureDevOps
40Create Angular WebSite
41Add static Angular to WebAPI .NET Core
42Docker for Angular
43Angular and CORS
44SSL , VSCode, Docker
45Routing in Angular
46RxJS for Routing
47RxJs Unsubscribe

Loading data regularly–deploy plugins–Azure Function–part 34

Now I have broken the build. Why ?Because of the docker file – to be optimized on local, I copy ecah csproj one by one and the I do dotnet restore. (If docker had a glob patttern! ) . So each time that I put a new project, the build will fail!

Trying now from the Azure Function to load the plugins . Apparently, the deploying does not deploy also the plugins ( Application Insights , connected to the Azure function ,is your friend – it can show you all kind of messages)

But now I have a problem copying the plugins. I do in azure Function like I have done with the other projects;

A post-build event

dotnet pwsh $(ProjectDir)preBuild.ps1 “$(RepoRoot)plugins\”  “$(TargetDir)”

and a file prebuild.ps1 file that says

echo “args 0 ”  $args[0]
echo “args 1 ” $args[1]
$a= Get-Location
echo $a
echo now copy
Copy-Item -Path $args[0] -Destination $args[1] -Recurse -Force

For all other projects it is working. For the azure function, it gives an error at the compiling time on CI ( not on local! )

/bin/sh: 3: /tmp/tmpdd44ee8bfe4f49dca815035fe3a451ee.exec.cmd: Syntax error: Unterminated quoted string

I found the problem

dotnet pwsh $(ProjectDir)preBuild.ps1 “$(RepoRoot)plugins\”  “$(TargetDir)”

Now, a different error raises on Github CI when compiling the Azure Function:

The specified framework ‘Microsoft.NETCore.App’, version ‘2.1.0’ was not found.

The problem  is here: https://github.com/Azure/azure-functions-vs-build-sdk/blob/master/src/Microsoft.NET.Sdk.Functions.MSBuild/Targets/Microsoft.NET.Sdk.Functions.targets 

<_FunctionsTaskFramework Condition=” ‘$(MSBuildRuntimeType)’ == ‘Core'”>netcoreapp2.1</_FunctionsTaskFramework>

I try to build into an netcoreapp3.0 docker container. I must install 2.1, probably.

For github actions:

– name: Setup .NET Core 2.1
       uses: actions/setup-dotnet@v1
       with:
         dotnet-version: 2.1.802

    – name: Setup .NET Core 3.0
       uses: actions/setup-dotnet@v1
       with:
         dotnet-version: 3.0.100

Not working!

But a new idea – what if I have the project not up-to-date  ? And indeed , the nuget for azure functions was not update. Now it works for GitHub actions!https://github.com/ignatandrei/InfoValutar/actions

Now , back to work  – I want to deploy the plugins in the Azure Function

Reading about ExecutionContext – ok. Reading about difference between FunctionAppDirectory and  FunctionDirectory  –https://github.com/Azure/azure-functions-host/wiki/Retrieving-information-about-the-currently-running-function . Ok – I want FunctionDirectory – I think it is just for this function.

For uploading files and folder, there are 2 ideas:

  1. to have included in .csproj ( do not want the plugins to be included !)
  2. To include in the zip file https://docs.microsoft.com/en-us/azure/azure-functions/deployment-zip-push 

So CI / CD to the rescue. I will do in AzureDevOps – next time!

Infovalutar

And one hour passes...
(This is the result of 1 hour per day auto-challenge as a full cycle developer for an exchange rates application)
( You can see the sources at https://github.com/ignatandrei/InfoValutar/ )
NrPost 
1Start
2Reading NBR from internet
3Source control and build
4Badge and test
5CI and action
6Artifacts and dotnet try
7Docker with .NET Try
8ECB
9Intermezzo - Various implementations for programmers
10Intermezzo - similar code - options
11Plugin implementation
12GUI for console
13WebAPI
14Plugin in .NET Core 3
15Build and Versioning
16Add swagger
17Docker - first part
18Docker - second part
19Docker - build Azure
20Pipeline send to Docker Hub
21Play with Docker - online
22Run VSCode and Docker
23Deploy Azure
24VSCode see tests and powershell
25Code Coverage
26Database in Azure
27Sql In Memory or Azure
28Azure ConString, RSS
29Middleware for backward compatibility
30Identical Tables in EFCore
31Multiple Data in EFCore
32Dot net try again
33Start Azure Function
34Azure function - deploy
35Solving my problems
36IAsyncEnumerable transformed to IEnumerable and making Azure Functions works
37Azure functions - final
38Review of 37 hours
39Last Commit in AzureDevOps
40Create Angular WebSite
41Add static Angular to WebAPI .NET Core
42Docker for Angular
43Angular and CORS
44SSL , VSCode, Docker
45Routing in Angular
46RxJS for Routing
47RxJs Unsubscribe

Loading data at regular intervals–Azure function –part 33

I need to load data at scheduled intervals – it is normal that the exchange rates are published every day.

So what options we have in Azure?

  1. WebJobs
  2. Worker Roles
  3. Azure functions

After reading a lot, I decide on Azure Functions – it is the new kid on the block and battle tested. More, it has something called Durable , https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-overview?tabs=csharp that seems very promising

I create the function in the Azure Portal –  just account that creation is not milliseconds, but seconds. And be sure that you craete under the same resource group as the previous resources.

The I create the function project template in Visual Studio.  Trying to deploy from Visual Studio – after configuring , the endpoint on Azureshows error. Thinking  – guess the problem – I configured the endpoint with Linux – and on my PC I have Windows. Deleting and creating another one – with Windows Containers. And now an error:”Requested feature is not available in resource group infovalutarRG. Please try using a different resource group or create a new one”

No wonder why is a DevOps thing nowadays…

Going back to Visual Studio – figuring “ Publish” has an edit – and I can see there that I can select on what OS I can publish to. => error on deploy. Investigating the logs – not understanding the error ( not enough details)

Ok –  now I want to create the Azure Function from within Visual Studio. Let’s see. Now publishing works, the website show a nice interface ( your functions is up and running) . But , even if successfully deployed, does not show my function!

Trying to get the deployment profile from the Azure WebSite – says that it cannot find the function. However, it is just a time caching problem. Some seconds later it shows the function!

Moral : do not rush. Caching is a bitch nowadays.

Infovalutar

And one hour passes...
(This is the result of 1 hour per day auto-challenge as a full cycle developer for an exchange rates application)
( You can see the sources at https://github.com/ignatandrei/InfoValutar/ )
NrPost 
1Start
2Reading NBR from internet
3Source control and build
4Badge and test
5CI and action
6Artifacts and dotnet try
7Docker with .NET Try
8ECB
9Intermezzo - Various implementations for programmers
10Intermezzo - similar code - options
11Plugin implementation
12GUI for console
13WebAPI
14Plugin in .NET Core 3
15Build and Versioning
16Add swagger
17Docker - first part
18Docker - second part
19Docker - build Azure
20Pipeline send to Docker Hub
21Play with Docker - online
22Run VSCode and Docker
23Deploy Azure
24VSCode see tests and powershell
25Code Coverage
26Database in Azure
27Sql In Memory or Azure
28Azure ConString, RSS
29Middleware for backward compatibility
30Identical Tables in EFCore
31Multiple Data in EFCore
32Dot net try again
33Start Azure Function
34Azure function - deploy
35Solving my problems
36IAsyncEnumerable transformed to IEnumerable and making Azure Functions works
37Azure functions - final
38Review of 37 hours
39Last Commit in AzureDevOps
40Create Angular WebSite
41Add static Angular to WebAPI .NET Core
42Docker for Angular
43Angular and CORS
44SSL , VSCode, Docker
45Routing in Angular
46RxJS for Routing
47RxJs Unsubscribe

Andrei Ignat weekly software news(mostly .NET)

* indicates required

Please select all the ways you would like to hear from me:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.