How does Blazor know at runtime the environment? - blazor-webassembly

In Blazor WASM, I noticed that webAssemblyHostBuilder.HostEnvironment.Environment will output "Development" if it is on dev machine's browser and "Production" if it is on a deployed environment.
How does Blazor WASM know the environment given that it is disconnected from the server and loading in the browser? In other words, I expect the components running on the server to know the hosting environment because it is an environment variable, but how does Blazor 'extract' this information from the hosting environment?

Related

How to debug ASP.NET MVC web app without pushing a commit in CodeStar (AWS)

There is something that I cannot really understand during the AWS CodeStar development flow. Let's say I am developing a web app (MVC) locally, it works and now I want to test it remotely before deploying to the final production environment.
CodeStar has created a Git repository for pushing the changes and it automatically starts the building, testing and deployment tasks. I have few questions:
How can I deploy a change to verify that it works BEFORE doing any sort of commit (avoiding to put dirty commits in the case there are some errors) to the remote environment?
How can I DEBUG a remotely ASP.NET application (breakpoints, etc...)?
How can I tell the application to use a different development database (or any other AWS service) while it is in the development "status" ?
Thank you for your delucidations.

Azure Function builder.GetContext().EnvironmentName always 'Development'

With reference to the official document
When this application setting isn't present when running in Azure, the environment is assumed to be Production.
Even after overriding AZURE_FUNCTIONS_ENVIRONMENT and ASPNETCORE_ENVIRONMENT to Production, I am still getting Development in Azure.
My Azure Function is a running on serverless consumption plan, on Windows environment, runtime version ~3.

AppSettings connection strings must be configurable by environment (Dev, Staging, UAT and Production)

I develop the code for my application against the Sandbox environment in Azure. my current appsettings.json file contains connection strings for Database, Azure Storage, etc which point to the Sandbox environment.
When the api is deployed through the DevOps pipeline to Dev, Staging and Production Env, the api should point to Database, azure Storage etc that are present in the respective environments Dev, staging and production.
I am trying to go with approach in Startup file
But I can't able to go further on the above to achieve this is in DevOps deployment.
You can achieve this by JSON variable substitution. For more information, refer here.

Kestrel seems to start but doesn't work when run as a different user

I have a small .net core WebAPI service running on kestrel. This is deployed automatically on multiple machines using TFS deployments. After deployment the automation tool runs this kestrel server on each deployed machine.
I can verify that:
the application starts on each machine (dotnet process is present in Task Manager)
the application listens on the correct port (because trying to run it manually on that port throws the error that port is in use)
BUT:
for the automatically started application I cannot access the webapi service in browser (http://localhost:8081) -- says 404
if I close the dotnet process started automatically and run it manually it works ok (WebApi accessible in browser)
Why doesn't it work correctly when started automatically? The only difference between processes seems to be the user under they are executed.
How could I troubleshoot this problem?

How to make WP8 emulator access ASP.NET debug server

Is it possible to get the WP8 emulator to access a ASP.NET Development debug server I run on my pc?
WP8 Emulator runs inside Hyper-V and the debug server on my pc is therefore not accessible to the emulator, is it possible to do so it is?
Only solution I can come up with is create a IIS server on my machine and debug that, but its much easier running development server.
The problem isn't really "how to access the development server from the emulator", but "how to access the development server from a remote location". The emulator is 'just' another device connected to the network.
And for that, I can suggest a few links:
http://blog.waynehartman.com/archive/2010/05/30/218.aspx
Is There a Way to Make Remote Calls to ASP.NET Development Web Server?

Resources