Tag: ASP.NET Core

AzureAzure ADAzure B2CBlazor

Blazor WASM hosted in ASP.NET Core templates with Azure B2C and Azure AD authentication using Backend for Frontend (BFF)

I have implemented many Blazor WASM ASP.NET Core hosted applications now for both Azure AD and Azure B2C authentication. I always implement security …

Blazor WASM hosted in ASP.NET Core templates with Azure B2C and Azure AD authentication using Backend for Frontend (BFF)
DevelopmentEvents

Discover the world of .NET – .NET Conf 2018

Discover the world of .NET for free this September 12-14, 2018 by attending the .NET Conf virtual developer event, which is co-organized by Microsoft and the .NET community. Over the course of the three days, you will have a wide selection of live sessions from .NET community and the .NET product teams. This is a great chance for you to learn, ask questions and get inspired for your next great project.

You will learn to build for web, mobile, desktop, games, services, libraries and more for a variety of platforms and devices all with .NET. We have sessions for everyone, no matter if you are just beginning or are a seasoned engineer. We’ll have presentations on .NET Core and ASP.NET Core, C#, F#, Azure, Visual Studio, Xamarin, and much more.

Join your fellow developers in a city near you, and learn more about the world of .NET, Azure, and Xamarin. To watch the sessions from last year, take a look at the 2017 sessions on demand from Channel 9.

Agenda

Day 1 – September 12

8:00 – 9:30
Keynote broadcasted from Microsoft Channel 9 Studios

9:30 – 17:00
Sessions broadcasted from Microsoft Channel 9 Studios

17:00 – 18:30
Virtual Attendee Party! Engage with our partners on Twitter and win prizes!

Day 2 – September 13

9:00 – 17:00
Sessions broadcasted from Microsoft Channel 9 Studios

17:00 – 23:59
Community Sessions in local languages & time zones around the world

Day 3 – September 14

0:00 – 17:00
Community Sessions in local languages & time zones around the world

All times listed are in Pacific Daylight Time (UTC -7).

Attend a Local .NET Conf

In addition to the three day virtual event being held from September 12-14, there will also be some local events you can attend. Take a look at this page for locations and to register. In Canada we will have 2 local events in Vancouver BC and Mississauga ON.

September 26, 2018
Vancouver, BC, Canada
Register Here

October 25, 2018
Mississauga, Ontario, Canada
Register Here

Run your own local event

If you’re interested in running your own .NET Conf take a look at this link for details.

Enjoy!

References

https://www.dotnetconf.net

https://www.dotnetconf.net/local-events/

https://github.com/dotnet-presentations/dotnetconf2018

Development

Getting Started with Application Insights for ASP.NET Core

In my previous posts I gave a quick Introduction to Application Insights and then I showed you how to Disable Application Insights from your app. In this post I’ll walk you through creating an ASP.NET Core application and then configuring it with Application Insights. Let’s get started.

Configuring your app for Application Insights

Start by creating a new ASP.NET Core application (this also applied to non-core ASP.NET applications). Once the application is created right click on the project file in the context menu look for Configure Application Insights… and then click on it.

image

You will see that the SDK has already been added to your application. Next click on the Start Free button to start using Application Insights.

image

You will need to have an existing Azure Subscription. If you don’t already have one you can create one for free and start with a $250 credit for 30 days + you will have access to popular services for 12 months + there are over 25 services that are always free. Now that you have your Azure Subscription, login with your Microsoft Account, select your Subscription and then a Resource. These can always be easily changed later on if need be.

You will now have access to the free plan which comes with 1 GB / Month of data included and data retention is 90 days. Click on he Register button to finish the configuration:

image

Now that Application Insights is configured for your application you have access to a wealth of information with the click of a button.

sshot-372

Accessing the Application Insights Telemetry from Visual Studio

You can search your Application Insights results from either the Azure Portal or from within Visual Studio. To use Visual Studio go to the View menu, select Other Windows and then Application Insight Search. You will then get view of the telemetry for the last 24 hours as shown below from a sample API I have. From here you can filter the telemetry and dive down into specific events.

image

Another nice feature is that Application Insights telemetry data including any exceptions that have been captured will show up in the CodeLens information as shown here:

image

There is a lot of value from using Application Insights in any of your applications. I hope you take a look and try it out for yourself.

Enjoy!

References

https://azure.microsoft.com/en-us/services/application-insights/

https://docs.microsoft.com/en-us/azure/application-insights/app-insights-asp-net-core

Development

How to Disable Azure Application Insights in ASP.NET Core

In my previous post I showed you how easy it was to get started with an Introduction to Application Insights for your ASP.NET Core application. However what if you you don’t want Application Insights? You might notice in your Output pane when running your app that it’s still partially enabled for you out of the box. I’ll walk you through what I mean by it being partially enabled and then how you can go about hiding it until such time you decide to fully turn it on. Let’s get started.

Start off by creating a new ASP.NET Core application (see below) and then immediately run it.

image

You will then notice that you will see the following statements in your Output pane:

Application Insights Telemetry (unconfigured): {“name”:”Microsoft.ApplicationInsights.Dev.Message”,”time”:”2018-03-24T03:39:26.5327026Z”,”tags”:{“ai.application.ver”:”1.0.0.0″,”ai.operation.parentId”:”|80d77757-4707b4b80d71a9b3.”,”ai.internal.sdkVersion”:”aspnet5c:2.1.1″,”ai.operation.id”:”80d77757-4707b4b80d71a9b3″,”ai.internal.nodeName”:”LT2206″,”ai.location.ip”:”127.0.0.1″,”ai.cloud.roleInstance”:”LT2206″,”ai.operation.name”:”GET Values/Get”,”ai.user.id”:”6RWa2″},”data”:{“baseType”:”MessageData”,”baseData”:{“ver”:2,”message”:”Executed action WebApplication5.Controllers.ValuesController.Get (WebApplication5) in 205.1085ms”,”severityLevel”:”Information”,”properties”:{“DeveloperMode”:”true”,”{OriginalFormat}”:”Executed action {ActionName} in {ElapsedMilliseconds}ms”,”ActionName”:”WebApplication5.Controllers.ValuesController.Get (WebApplication5)”,”AspNetCoreEnvironment”:”Development”,”ElapsedMilliseconds”:”205.1085″,”CategoryName”:”Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker”}}}}

image

You might be wondering why is it doing this and how can I disable it?

The easiest way to disable Application Insights without going through the process of ripping it out is to just disable it. You can do this by accessing TelemetryConfiguration.Active.DisableTelemetry and setting this to true. What I would recommend doing is to add a static method to your Startup.cs file and call this method from your Configure method like so:

image

Now when you run your application and look in the Output pane you will no longer see any statement pertaining to Application Insights.

image

I see a great deal of value of keeping Application Insights and using it in all your applications, so if you need to disable it then maybe do this when running in debug mode by using a conditional attribute on the method.

Enjoy!

References

https://github.com/aspnet/Home/issues/2051

Development

Error when opening an ASP.NET Core project with Visual Studio 2015 after installing Visual Studio 2017 RC : The following error occurred attempting to run the project model server process 1.0.0-preview4-004223

Ok so if your like me and tried installing Visual Studio 2017 RC, you were probably astonished at how fast it installs compared to previous version of Visual Studio. But as impressive at it is at installing, I ran into some compatibility issues with Visual Studio 2015, so I had to uninstall Visual Studio 2017 RC.

Now even with Visual Studio 2017 RC uninstalled, I ended up running into an issue when I was trying to open a  new or existing ASP.NET Core project. Here is the error I would get when trying to open my ASP.NET Core projects in Visual Studio 2015:

The following error occurred attempting to run the project model server process 1.0.0-preview4-004223

image

To resolve this, I had to go to directory “C:\Program Files\dotnet\sdk” and delete folder “1.0.0-preview4-004233” as shown here:

image

This then resolved my issue when trying to open an existing or new ASP.NET Core project in Visual Studio 2015.

Enjoy!