ASP.NET Core
188 TopicsMulti-project launch profiles not working
Hi, I am using Visual Studio 2022 (version 17.12.3) for an ASP.NET + React project. I want to take advantage of the new launch profiles feature to have multiples profiles for http and https, edge and chrome, etc. The feature is enabled, and I am able to create my profiles. So far so good. I have even ticked the share box so a .slnLaunch has been created. But when I am back to the main VS screen, I don't have the dropdown list in my toolbar to chose the profile to launch. I just have the old tooldbar : I tried to : Restart VS Restart my PC Disable/enable the feature with VS restarts in between Sorry for the screenshots in french btw ;) Thanks in advance !74Views0likes0CommentsMultiple ASP.NET Core Web API instances runs only once
I have an ASP.NET Core 8.0 Web API hosted on two IIS applications (app-1 and app-2) under the Default Web Site on a Windows 11 OS. Both IIS applications point to the same physical path (inetpub\wwwroot\myapp) and each application has its own dedicated application pool (app1andapp2). The application pools have unique identities (app1svcandapp2svc), both of which are members of the Administrators group. In the Web API, I have anAppEventsclass implementingIHostedService, withStartAsyncandStopAsyncmethods to handle application start and stop events. In theProgram.cs, I register it usingbuilder.Services.AddHostedService<AppEvents>(). When accessinghttp://localhost/app-1, theStartAsyncmethod is triggered as expected. However, when accessinghttp://localhost/app-2, theStartAsyncmethod does not execute. It seems that the application starts only once, despite both IIS apps pointing to the same physical directory. I've tried changing theAspNetHostingModelfromInProcesstoOutOfProcess, but the behavior remains the same. Is there a way to deploy multiple instances of the same web app, each running separately but pointing to the same physical directory, so that each instance correctly triggers its own StartAsync?26Views0likes0CommentsDeploy your ASP.NET Core Web API with the help of GitHub Copilot for Azure in Visual Studio Code.
Introducing GitHub Copilot for Azure, your personal assistant to streamline the deployment process. It provides you with clear, step-by-step instructions to deploy your applications and assists with troubleshooting, making your development journey smoother and more efficient. In this blog, we’ll explore how to deploy an ASP.NET Core API to Azure using GitHub Copilot for Azure in Visual Studio Code. By leveraging Copilot’s AI capabilities, I’ll guide it with prompts to streamline the deployment process. Together, we’ll learn how to transform a locally developed API into a cloud-hosted solution with ease. Prerequisites An Azure account and a subscription. Create Azure for free or pay as you go A GitHub account and GitHub Copilot Subscription. creating-an-account-on-GitHub and quick start on copilots Visual Studio code. See more info on setting up vs code GitHub Copilot and GitHub Copilot Chat Extension. Set up GitHub Copilot in VS Code and Getting started with Copilot Chat in VS Code .NET SDK. Download it here, C# Dev-kit Extension in VS Code. More on C# Dev-kit Prepare I will be deploying the TodoApi developed with ASP.NET Core. The source code is available on GitHub. Follow these steps to have the project on your local machine. Head to the GitHub repo: Github-Copilot-for-Azure-TodoApi-Sample Clone the Repository on your terminal or download as Zip: git clone https://github.com/kemboi590/Github-Copilot-for-Azure-TodoApi-Sample-.git Change directory to the cloned folder: cd Github-Copilot-for-Azure-TodoApi-Sample- Install required Packages: dotnet restore Open with Visual Studio Code: code . Here is an illustration of the steps: Run the application - Open the inbuilt terminal on Visual Studio Code and type the following: dotnet run The API is now running and we can test it using REST Client. Calling REST APIs From the IDE Install the rest client extension. - Open the extension and search for Rest Client and install it. Open TodoApi.http file and start testing the routes: GitHub Copilot Set up When you install GitHub Copilot Extension, you also get GitHub Copilot Chat, a conversational extension that provides conversational AI assistance Go to extensions Search for GitHub Copilot Install GitHub Copilot for Azure GitHub Copilot for Azure extension is designed to help streamline the process of developing for Azure. On extensions, search for GitHub Copilot for Azure Install the extension Start your Conversation with GitHub Copilot for Azure extension Open the chat, use the shortcut keys: ctr + shift + I or open chat by clicking on the chat Icon. To use GitHub Copilot for Azure use azure then describe what you want it to help you with. I will share with you my prompts that I am using so that you can use them as well. Note: Your GitHub Copilot for Azure may not give the same output as mine. Here are the steps to Deploy our WebApp. Describe what you want GitHub Copilot for Azure to help you with. - Give a clear information so that the copilot will get to respond better. - Try this prompt: @Azure I have developed an ASP.NET Core web API using Visual Studio Code, which is a simple TodoAPI with CRUD Functionalities with no database, I would like to deploy it on azure with your help because I have no experience. Which services should I use and which options do I have to have it on azure - GitHub Copilot for Azure Suggest that for an API, we should use Azure App Services Let’s ask for more details @Azure to deploy Azure App services on Visual Studio Code, which are the available options? We now have three options, o Using Visual Studio Code Extension – App Service Extension o Manual Process – On Azure Portal o Automated CI/CD Pipeline on GitHub App Service Extension - I will go with the first Option (Using Visual Studio Code– App Service Extension) Asking for more steps I will ask GitHub Copilot to give me some steps I will use to deploy using App Service Extension @Azure Guide me on the steps using App Service Extension - Open the extensions and install App Service Extension - You will be requested to sign in to your azure account. Ensure you have azure subscription so that you can be able to deploy your API. Working with Azure tools - You will note that Azure icon is available is the side bar - Click on it and you will see the App Services under your subscription. Create an App Service Web App from the available options - Click on App Service and click on Create button (+) to create an App Service Web App. Web App Name - Give a unique name of your new web app and click Enter - I will name mine azure-copilot-demo Choose Runtime Stack - If you are following along with TodoApi project, select .NET 9 and click Enter. Select Pricing Tier Let’s ask copilot of these pricing tiers: @Azure While selecting the pricing tiers, i see three options. Free F1 Basic B1 Premium P1V2 Which one do I select I will select Basic (B1) because I consider my project small-to-medium applications and low-traffic production workloads. Web App created on the Terminal for Azure - It will take some few seconds for the web app to be created Publish your App - Want to know why should you publish your project? - Let’s ask GitHub copilot for Azure for clarification: @Azure what does this command do? - Open the terminal on the folder with the project and type the following command: dotnet publish -c Release -o ./bin/Publish New bin/publish Folder has been created - The folder contains our project which is now ready to deploy Deploy - Right Click on the new web app (azure-copilot-demo) on the list and choose deploy to web app - Browse the /bin/publish folder and select it: Deployment success - It will take some few mins for the Web App to be deployed. Check on your terminal for Azure. - Wait for some time then your web pp will be running on Azure. Working with deployed Web App - I will also use REST Client to test the deployed web App on Visual Studio Code. - The end pot I will be using will be: https://azure-copilot-demo.azurewebsites.net/ - Without starting the server this time, replace the Host Address with the one you got after deploying the web App. POST Request: - Test the other routes and they should all be working just fine. Conclusion We have been able to deploy our TodoApi with the help of GitHub Copilot for Azure. I hope you had a great time following a long and were able to deploy your application as well. You are not limited to deploying the Web Apps alone with the help of GitHub Copilot for Azure. Feel free to explore other services and remember to share feedback. Resources Get started with GitHub Copilot for Azure Preview Get started with GitHub Copilot Training Module on Microsoft Learn Example prompts for learning about Azure and your application with GitHub Copilot for Azure Preview229Views2likes0CommentsIs it possible to run a asp.net core site within testing?
Hi! I'm trying to write tests for a small minimal API based on asp.net core. I don't want to test over the internet, but start the app within the tests and call the endpoints on the running site. Is this possible? And how? Should I use TestServer for this? I'm new to writing tests, so maybe it's an easy issue to code. Thanks! :)12Views0likes0CommentsLet's Learn .NET - AI
Learn about AI, how to get started, and using ChatGPT to improve text completions. Come to learn something new and leave with something that we all built, together, live with experts! Community Links:https://aka.ms/letslearn/dotnet/ai Featuring: Luis Quintanilla (luquinta@microsoft.com) #AI #dotNET #ChatGPT4KViews0likes3CommentsASP.NET Community Standup - Implementation of the .NET WebAssembly Jiterpreter
A technical talk by Katelyn Gadd about the design and implementation of the .NET WebAssembly Jiterpreter. Community Links: https://www.theurlist.com/blazor-standup-2023-07 Featuring: Katelyn Gadd, Jon Galloway (@jongalloway), Mackinnon Buck (@MackinnonBuck) #Blazor #WebAssembly #dotnet952Views0likes0CommentsASP.NET Community Standup | Implementation of the .NET WebAssembly Jiterpreter
A technical talk by Katelyn Gadd about the design and implementation of the .NET WebAssembly Jiterpreter. Community Links: https://www.theurlist.com/blazor-standup-2023-07 Featuring: Katelyn Gadd, Jon Galloway (@jongalloway), Mackinnon Buck (@MackinnonBuck) #Blazor #WebAssembly #dotnet2KViews0likes0CommentsOn .NET Live - Building full stack applications using gRPC-Web in ASP.NET Core
gRPC is a modern, high-performance framework that streamlines messaging between clients and back-end services. In this week's episode, community MVP Swamy Viswanatha stops by to show us how to build a full-stack application using gRPC-Web in ASP.NET Core. Featuring: Swamy Viswanatha (@vishipayyallore) #grpc #webapi #dotnet #aspnetcore1.5KViews0likes1CommentLive in 21 hours June 29 at 11:00 AM Notify me Let's Learn .NET - Web Development
Learn the basics of web development by writing HTML and CSS code to create an accessible webpage using the browser-based version of Visual Studio Code. Then build your first webpage using Razor with ASP.NET Core. Come to learn something new and leave with something that we all built, together, live with experts! Resource links: https://aka.ms/letslearndotnet-webdev https://github.com/dotnet/intro-to-dotnet-web-dev Web Dev Around the World Series https://aka.ms/letslearndotnet Featuring: Cam Soper (@camsoper), Jayme Singleton (@jaymesingleton1) #VSCode #AspNetCore #Razor #dotnet297Views0likes0Comments