Code Monkey home page Code Monkey logo

eshoponazure's Introduction

eShop Reference Application - "AdventureWorks"

A reference .NET application implementing an e-commerce website using a services-based architecture using .NET Aspire.

eShop Reference Application architecture diagram

eShop homepage screenshot

Getting Started

Prerequisites

Windows with Visual Studio

  • Install Visual Studio 2022 version 17.10 or newer.
    • Select the following workloads:
      • ASP.NET and web development workload.
      • .NET Aspire SDK component in Individual components.
      • Optional: .NET Multi-platform App UI development to run client apps

Or

  • Run the following commands in a Powershell & Terminal running as Administrator to automatically configure your environment with the required tools to build and run this application. (Note: A restart is required and included in the script below.)
install-Module -Name Microsoft.WinGet.Configuration -AllowPrerelease -AcceptLicense -Force
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
get-WinGetConfiguration -file .\.configurations\vside.dsc.yaml | Invoke-WinGetConfiguration -AcceptConfigurationAgreements

Or

  • From Dev Home go to Machine Configuration -> Clone repositories. Enter the URL for this repository. In the confirmation screen look for the section Configuration File Detected and click Run File.

Mac, Linux, & Windows without Visual Studio

dotnet workload update
dotnet workload install aspire
dotnet restore eShop.Web.slnf

Or

  • Run the following commands in a Powershell & Terminal running as Administrator to automatically configuration your environment with the required tools to build and run this application. (Note: A restart is required after running the script below.)
Install Visual Studio Code and related extensions
install-Module -Name Microsoft.WinGet.Configuration -AllowPrerelease -AcceptLicense  -Force
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
get-WinGetConfiguration -file .\.configurations\vscode.dsc.yaml | Invoke-WinGetConfiguration -AcceptConfigurationAgreements

Note: These commands may require sudo

Note: When running on Mac with Apple Silicon (M series processor), Rosetta 2 for grpc-tools.

Running the solution

Warning

Remember to ensure that Docker is started

  • (Windows only) Run the application from Visual Studio:
  • Open the eShop.Web.slnf file in Visual Studio
  • Ensure that eShop.AppHost.csproj is your startup project
  • Hit Ctrl-F5 to launch Aspire
  • Or run the application from your terminal:
dotnet run --project src/eShop.AppHost/eShop.AppHost.csproj

then look for lines like this in the console output in order to find the URL to open the Aspire dashboard:

Login to the dashboard at: http://localhost:19888/login?t=uniquelogincodeforyou

You may need to install ASP.NET Core HTTPS development certificates first, and then close all browser tabs. Learn more at https://aka.ms/aspnet/https-trust-dev-cert

Azure Open AI

When using Azure OpenAI, inside eShop.AppHost/appsettings.json, add the following section:

  "ConnectionStrings": {
    "OpenAi": "Endpoint=xxx;Key=xxx;"
  }

Replace the values with your own. Then, in the eShop.AppHost Program.cs, set this value to true

bool useOpenAI = false;

Here's additional guidance on the .NET Aspire OpenAI component.

Use Azure Developer CLI

You can use the Azure Developer CLI to run this project on Azure with only a few commands. Follow the next instructions:

  • Install the latest or update to the latest Azure Developer CLI (azd).
  • Log in azd (if you haven't done it before) to your Azure account:
azd auth login
  • Initialize azd from the root of the repo.
azd init
  • During init:

    • Select Use code in the current directory. Azd will automatically detect the .NET Aspire project.
    • Confirm .NET (Aspire) and continue.
    • Select which services to expose to the Internet (exposing webapp is enough to test the sample).
    • Finalize the initialization by giving a name to your environment.
  • Create Azure resources and deploy the sample by running:

azd up

Notes:

  • The operation takes a few minutes the first time it is ever run for an environment.
  • At the end of the process, azd will display the url for the webapp. Follow that link to test the sample.
  • You can run azd up after saving changes to the sample to re-deploy and update the sample.
  • Report any issues to azure-dev repo.
  • FAQ and troubleshoot for azd.

Contributing

For more information on contributing to this repo, read the contribution documentation and the Code of Conduct.

Sample data

The sample catalog data is defined in catalog.json. Those product names, descriptions, and brand names are fictional and were generated using GPT-35-Turbo, and the corresponding product images were generated using DALL·E 3.

Other eShops

For a closely related version of this app that is not Azure specific, please view the dotnet/eShop repo. These two repos share some common code.

eshoponazure's People

Contributors

dependabot[bot] avatar adityamandaleeka avatar captainsafia avatar brennanconroy avatar danmoseley avatar srushtipasari94 avatar jamesmontemagno avatar michaelstonis avatar stephentoub avatar stevesandersonms avatar 3lcarry avatar davidfowl avatar eerhardt avatar lutzroeder avatar microsoftopensource avatar sebastienros avatar ellismg avatar martincostello avatar mairaw avatar jflaga avatar erinnmclaughlin avatar saiphanish avatar microsoft-github-operations[bot] avatar iem365-michael avatar egvijayanand avatar vhvb1989 avatar robconery avatar peterblazejewicz avatar onurkanbakirci avatar mkhalesi avatar

Stargazers

Jeet Majumdar avatar  avatar Hans Meyer avatar JJ Swart avatar ahzeren avatar Kyou avatar MJendza avatar Reed Salus avatar Grimaldo SOTO avatar  avatar Oprea Mihai avatar Camilo E. Hidalgo Estevez avatar Mikkel Hammer avatar yu-ting-wu avatar Adeniyi avatar Jose Luis Rodriguez avatar Mahmoud Kandeel avatar Martin Ballasco Ramos avatar Vincent van Proosdij avatar Logan Marshall avatar  avatar  avatar Andrew Taylor avatar Shuvra Sourav Das avatar kcKustoMac avatar  avatar  avatar Pascal Tbf avatar Bulent Karaahmed avatar Gabriel Sales avatar Daniel avatar  avatar Md Yasir avatar Sardor Sohinazarov avatar Cosmas Philip avatar Cleiton Hoffmann avatar  avatar Aymen avatar kappa mu avatar Yousef Akhavan avatar Oleksii Nikiforov avatar Radoaica Danut Cosmin avatar Kerkko Niemi avatar Mo Hadi avatar Jeremy Whiteley avatar Neno Loje avatar kdcllc avatar Andrea Tosato avatar David Heale avatar Stephen Eidson avatar Kevin avatar Mike Wzorek avatar Gareeb Navas T M avatar  avatar Ashen Sandaruwan avatar Nuno Nogueira avatar Andrejs Agejevs avatar  avatar Đorđe Petrović avatar Greg Brewer avatar Muhammad Sulaiman avatar Simone avatar  avatar Héctor Reyna avatar Filip Johnsson avatar M. Paczesny avatar Kendy avatar Alexander Gorban avatar  avatar Toheeb Badru avatar anTONIos avatar Julio Gutierrez avatar Iram Lee avatar Noel avatar Carles Company Soler avatar José Antônio avatar jaysonv avatar  avatar Peter Gorbar avatar Saif Alaqqad avatar David Foley avatar Jose Bueno avatar EDW avatar  avatar Erkin İşçi avatar Timo Knapp avatar  avatar Fakhrul Chowdhury avatar  avatar Valentyn Podholov avatar TheCocce avatar Roman Marusyk avatar  avatar Jean Christophe Roy avatar chiguniiita avatar Dhiego Ferreira avatar Etinosa Emmanuel avatar Sam Johnson avatar Roger Killam avatar  avatar

Watchers

Erik St. Martin avatar Yousef Akhavan avatar  avatar  avatar Oscar Vaquero Viñes avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar punkouter24 avatar

eshoponazure's Issues

[WebToolsE2E][Aspire] After successful deployment the eShop.web solution, logging into the account fails with a 500 error.

INSTALL STEPS

  1. Clean machine: Win11 x64 23h2 ENU
  2. Install VS 17.10 Preview 7 [ Includes Aspire 8.0.0-preview.7.24251.11 and SDK 8.0.300-preview.24203.14 ]
  3. Install Docker Desktop for Windows
  4. Install azd version [1.9.0]

REPRO STEPS

  1. Clone eShopOnAzure repo
  2. Update sdk version to 8.0.300-preview.24203.14 in global.json
  3. Open eShop.Web.slnf
  4. Build
  5. Deploy using azd
    • Open the solution folder in a Command Prompt
    • Run azd init, select 'Use code in the current directory' > Confirm and continue initializing my app, type a new environment name, press enter
    • Run azd up to deploy to Azure
  6. After deployment successful, open the deployed webapp service url and log in to the account

ACTUAL
After successful deployment, login account fails: Error: 500
image

NOTE

  • But for similar eShop repo, you can successfully log in to your account after deployment.

EXPECTED
After successful deployment, you can successfully log in to your account.
image

Add Product LInk to chat experience..

Chat gives great recommendations but lacks a product link to directly add to shopping bag . It adds the product description and even an image would be awesome to have a quick add to shopping bag or a link that goes to the product item individually so the user could explore more.

image

[WebToolsE2E][Aspire] Failed to run eShop.web solution: "Failed to apply configuration value 'APPLICATIONINSIGHTS_CONNECTION_STRING'."

REGRESSION INFO: Also repro on Aspire 8.0 Preview 6

INSTALL STEPS

  1. Clean machine: Win11 x64 23h2 ENU
  2. Install VS 17.10 Preview 7 [ Includes Aspire 8.0.0-preview.7.24251.11 and SDK 8.0.300-preview.24203.14 ]
  3. Apply NuGet dotnet-tools Feed
  4. Install Docker Desktop for Windows

REPRO STEPS

  1. Clone eShopOnAzure repo, Checkout the aspire-preview7 branch
  2. Update sdk version to 8.0.300-preview.24203.14 in global.json
  3. Open eShop.Web.slnf
  4. Build and Run (F5 / Ctrl+F5)

ACTUAL
Failed to apply configuration value 'APPLICATIONINSIGHTS_CONNECTION_STRING'. A dependency may have failed to start.
image
image

EXPECTED
All projects run successfully.

[WebToolsE2E][Aspire] On VS 17.10 GA, opening eShop.web fails with error: "Unable to find a stable package Microsoft.NET.ILLink.Tasks with version (>= 8.0.5)", Even though I have applied the feed of sdk 8.0.300.

REGRESSION INFO: Worked fine on VS 17.10 GA [34908.272.d17.10] + 1.10.0-beta.1-daily.3768065 + Aspire 8.0.0 (older machine)

INSTALL STEPS

  1. Clean machine: Win11 x64 23h2 ENU
  2. Install VS 17.10 GA[34910.138.d17.10] [ Includes Aspire 8.0.0 and SDK 8.0.300 ]
  3. Apply NuGet darc-pub-dotnet-aspire Feed
  4. Apply sdk 8.0.300 feed
  5. Install cred helper
  6. Install Docker Desktop for Windows
  7. Install latest azd [1.10.0-beta.1-daily.3780018]

REPRO STEPS

  1. Clone eShop repo from main bracnh (Aspire 8.0 P7)
  2. Open eShop.Web.slnf
  3. Open global.json and update sdk version to 8.0.300
  4. Build

ACTUAL
NU1103 Unable to find a stable package Microsoft.NET.ILLink.Tasks with version (>= 8.0.5)
Found 21 version(s) in nuget [ Nearest version: 8.0.100-1.23067.1 ]
Versions from C:\Program Files\dotnet\library-packs were not considered
image

EXPECTED
Opening eShop solution without any errors (Aspire 8.0 P7)

[WebToolsE2E][Aspire] Manually updating eShopOnAzure to 8.0.0, then opening eShop.web fails with error: "Unable to find package Aspire.Azure.AI.OpenAI with version (>= 8.0.0)."

REGRESSION INFO: Worked fine on main branch (Aspire 8.0 P7)

INSTALL STEPS

  1. Clean machine: Win11 x64 23h2 ENU
  2. Install VS 17.10 GA FB [ Includes Aspire 8.0.0 and SDK 8.0.300 ]
  3. Apply NuGet darc-pub-dotnet-aspire Feed
  4. Install Docker Desktop for Windows

REPRO STEPS

  1. Clone eShopOnAzure repo
  2. Refer to the eShop repo to manually update Aspire to 8.0.0.
  3. Open eShop.Web.slnf
  4. Build

ACTUAL
NU1102 Unable to find package Aspire.Azure.AI.OpenAI with version (>= 8.0.0)
Found 1 version(s) in dotnet-tools-pub [ Nearest version: 8.0.0-preview.8.24258.2 ]
Versions from azure-sdk-for-net-dev were not considered
Versions from C:\Program Files\dotnet\library-packs were not considered
Versions from nuget were not considered
image

NuGet.config
image

NOTE

  • Using same machine to open eShop.Web from main branch (8.0 P7), it works fine.

EXPECTED
Opening eShop solution without any errors

I encountering WebSocket disconnection problems with SignalR after deploying project to Azure portal.

Hi,
I am new to eShopOnAzure and I encountering WebSocket disconnection problems with SignalR after deploying my project to Azure portal. This issue is impacting the functionality of my application, and I am seeking guidance on how to resolve it.

Could someone please provide assistance on troubleshooting and fixing this WebSocket disconnection problem in the context of deployment on Azure? Any insights, suggestions, or best practices?

Add Instructions for setting up Azure components

There are currently 3 Azure components in use that need to be setup

  • ServiceBus
  • Azure Monitor
  • Entra

We should add instructions on how to set all of these up both in the portal and in the application code/config.

Entra:
In portal create scopes: basket, orders, webhooks
In portal authorize Client application
In portal add redirect url: https://localhost:7298/signin-oidc
Find and replace <tenant id> in app
Find and replace <client id> in app
Create client secret in portal, copy value to <client secret> in app

Service Bus:
Modify "eventBus": <namespace> in eShop.AppHost appsettings.json
In the portal add topic "eshop_event_bus" when running locally
In the portal add "Azure Service Bus Data Owner" role to the identity that is creating the subscriptions

[WebToolsE2E][Aspire] Getting some package downgrade errors when opening eShopOnAzure/eShop.Web solution.

REGRESSION INFO: Worked on Aspire 8.0 Preview 5

INSTALL STEPS

  1. Clean machine: Win11 x64 23h2 ENU
  2. Install VS 17.10 Preview 6 [ Includes Aspire 8.0.0-preview.6.24214.1 and SDK 8.0.300-preview.24203.14 ]
  3. Install Docker Desktop for Windows

REPRO STEPS

  1. Clone eShopOnAzure repo, Checkout the aspire-preview6 branch
  2. Update sdk version to 8.0.300-preview.24203.14 in global.json
  3. Open eShop.Web.slnf

ACTUAL
Warning As Error: Detected package downgrade: OpenTelemetry.Extensions.Hosting from 1.8.0 to 1.7.0. Reference the package directly from the project to select a different version. eShop.ServiceDefaults -> Aspire.Azure.Messaging.ServiceBus 8.0.0-preview.6.24214.1 -> OpenTelemetry.Extensions.Hosting (>= 1.8.0) eShop.ServiceDefaults -> OpenTelemetry.Extensions.Hosting (>= 1.7.0)

Warning As Error: Detected package downgrade: AspNetCore.HealthChecks.AzureServiceBus from 8.0.1 to 8.0.0. Reference the package directly from the project to select a different version. EventBusServiceBus -> Aspire.Azure.Messaging.ServiceBus 8.0.0-preview.6.24214.1 -> AspNetCore.HealthChecks.AzureServiceBus (>= 8.0.1) EventBusServiceBus -> AspNetCore.HealthChecks.AzureServiceBus (>= 8.0.0)

Detected package downgrade: OpenTelemetry.Extensions.Hosting from 1.8.0 to centrally defined 1.7.0. Update the centrally managed package version to a higher version. Webhooks.API -> Aspire.Npgsql.EntityFrameworkCore.PostgreSQL 8.0.0-preview.6.24214.1 -> OpenTelemetry.Extensions.Hosting (>= 1.8.0) Webhooks.API -> OpenTelemetry.Extensions.Hosting (>= 1.7.0)

Detected package downgrade: OpenTelemetry.Extensions.Hosting from 1.8.0 to centrally defined 1.7.0. Update the centrally managed package version to a higher version. Webhooks.API -> Aspire.Azure.Messaging.ServiceBus 8.0.0-preview.6.24214.1 -> OpenTelemetry.Extensions.Hosting (>= 1.8.0) Webhooks.API -> OpenTelemetry.Extensions.Hosting (>= 1.7.0)

image

Note

  1. Manually updating the relevant package versions does not resolve these errors either.

EXPECTED

Opening and building solution without any errors.

[Question] How to deal with integration events and horizontal scaling of the Blazor Web App?

Hello!

Currently, Blazor Web App stores all the subscription callbacks that need to be fired when an integration event is handled in a dictionary which has the buyer ID as the key. Integration events contain the buyer ID in the payload that is then used to correctly trigger the corresponding callback.

But if we scale out the Blazor Web App to two instances after the Azure deployment, some integration events might not be properly handled because of the Azure Service Bus implementing the competing consumers pattern.

Example:

Blazor Web App instance A --stores---> subscription callback for buyer ID 1
Blazor Web App instance B --stores---> subscription callback for buyer ID 2

Both instances are using the same topic subscription to receive messages.

An OrderStatusChangedToCancelledIntegrationEvent is published to the Azure Service Bus topic for buyer ID 1, but the message is processed by Blazor Web App instance B. No callback will be called because Blazor Web App instance B doesn't have any subscription registered for buyer ID 1.

How to handle this scenario?

Best regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.