Unable to hit breakpoints in Blazor WASM - debugging

I am trying to debug a Blazor WebAssembly app but get the following message when trying to set breakpoints:
If I do the action that would hit the breakpoint, visual studio instead opens a new tab that says Unable to retrieve source content (Unable to retrieve source content). I have the same issue in a separate blazor server app, as well as the sample template that is provided when first creating a blazor project (counter.razor and fetchdata.razor).
Here is the info on the app:
Target Framework: .NET 5.0 (Current)
Authentication Type: None
Configure for HTTPS: True
ASP.NET Core hosted: False
Progressive Web Application: True
I am using Visual Studio 2019 version 16.9.4.
My .csproj file is:
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.5" PrivateAssets="all" />
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup>
</Project>
My launchSettings.json file is:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:59417",
"sslPort": 44389
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Test": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
I have tried the solutions given here and here.
I also checked https://devblogs.microsoft.com/aspnet/blazor-webassembly-3-2-0-preview-3-release-now-available/, even though it is a year old.
I restarted Visual studio multiple times, deleted the .vs file, restarted my comp, but the same issue.

The reason for the error was that my solution path had a "#' in a folder name. This error was discussed https://github.com/dotnet/aspnetcore/issues/22036 which apparently was never resolved if you follow the thread.

Related

Blazor Debugging not hitting breakpoints

I am taking over maintenance of an ASP.Net Hosted WebAssembly project. Cannot debug it. I have added "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" to the launchsettings, I have done the Shift+Alt+D and then command window to restart Edge in debug mode. Nothing works, I do not see source code in the debug window, I cannot hit breakpoints server-side.
My feelings at this time are in a language ALL programmers know (unprintable as it is).
I could use some guidance from cooler and more experienced heads. I tried an alternate approach (code server side and switch to client-side) using this as a model https://github.com/ShaunCurtis/AllinOne but I still cannot debug.
I realize this may be iterative.
EDIT:
I've embedded both launchsetting files, the API is the startup project and I am using IIS Express to start the process.
Edge Version: Version 92.0.902.62 (64 bit)
VS2019 Professional Version: 16.10.4
WASM:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:41506/wasm",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/wasm/_framework/debug/ws-proxy?browser={browserInspectUri}"
},
"Blazor": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": "true",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/wasm/_framework/debug/ws-proxy?browser={browserInspectUri}"
}
}
}
API:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:1686",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Blazor.API": {
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": "true"
}
}
}
EDIT 2 - Verbose Debug log
{"timestamp":1628178096458,"tag":"runtime.welcome","level":1,"message":"js-debug v1.54.2 started","metadata":{"os":"win32 x64","nodeVersion":"v12.20.1","adapterVersion":"1.54.2"}}
{"tag":"dap.receive","timestamp":1628178096359,"metadata":{"connectionId":0,"message":{"type":"request","command":"initialize","arguments":{"pathFormat":"path","clientID":"visualstudio","clientName":"Visual Studio","adapterID":"pwa-msedge","locale":"en-US","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsRunInTerminalRequest":true,"supportsMemoryReferences":true,"supportsProgressReporting":true,"SupportsMessageBox":true,"supportsHandshakeRequest":true,"supportsVsAdditionalBreakpointBinds":true,"supportsHitCountsChange":true,"supportsVsCustomMessages":true,"supportsVariableEnumerators":true,"supportsMapURLToFilePathRequest":true,"supportsLaunchUnelevatedProcessRequest":true,"supportsAccessingSourcesThorughClient":true},"seq":1}},"level":0}
{"tag":"dap.send","timestamp":1628178096360,"metadata":{"connectionId":0,"message":{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"exceptionBreakpointFilters":[{"filter":"all","label":"Caught Exceptions","default":false,"supportsCondition":true,"description":"Breaks on all throw errors, even if they're caught later.","conditionDescription":"error.name == \"MyError\""},{"filter":"uncaught","label":"Uncaught Exceptions","default":false,"supportsCondition":true,"description":"Breaks only on errors or promise rejections that are not handled.","conditionDescription":"error.name == \"MyError\""}],"supportsStepBack":false,"supportsSetVariable":true,"supportsRestartFrame":true,"supportsGotoTargetsRequest":false,"supportsStepInTargetsRequest":false,"supportsCompletionsRequest":true,"supportsModulesRequest":false,"additionalModuleColumns":[],"supportedChecksumAlgorithms":[],"supportsRestartRequest":true,"supportsExceptionOptions":false,"supportsValueFormattingOptions":true,"supportsExceptionInfoRequest":true,"supportTerminateDebuggee":false,"supportsDelayedStackTraceLoading":true,"supportsLoadedSourcesRequest":true,"supportsLogPoints":true,"supportsTerminateThreadsRequest":false,"supportsSetExpression":false,"supportsTerminateRequest":false,"completionTriggerCharacters":[".","[","\"","'"],"supportsBreakpointLocationsRequest":true,"supportsClipboardContext":true,"supportsExceptionFilterOptions":true}}},"level":0}
{"tag":"dap.send","timestamp":1628178096362,"metadata":{"connectionId":0,"message":{"seq":2,"type":"event","event":"initialized","body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1628178096445,"metadata":{"connectionId":0,"message":{"type":"request","command":"launch","arguments":{"WebRoot":"C:\\Users\\kah6235_aero\\source\\repos\\Blazor\\Blazor.API\\wwwroot","rootPath":"C:\\Users\\kah6235_aero\\source\\repos\\Blazor\\Blazor.API\\wwwroot","__workspaceFolder":"C:\\Users\\kah6235_aero\\source\\repos\\Blazor\\Blazor.API\\wwwroot","runtimeExecutable":"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe","runtimeArgs":[],"sourceMaps":true,"url":"http://localhost:1686/","trace":{"logFile":"C:\\Users\\kah6235_aero\\AppData\\Local\\Temp\\visualstudio-js-debugger.txt"},"port":54163,"launchUnelevated":false,"projectGuid":"4b5339f8-89f7-4c12-8c79-16d15d96f21d","userDataDir":"C:\\Users\\kah6235_aero\\AppData\\Local\\Microsoft\\VisualStudio\\16.0_5ac7f469\\WebTools\\F17440DA_75625535","breakOnLoad":true,"smartStep":true,"skipFiles":[],"showAsyncStacks":true,"timeout":60000,"inspectUri":"{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}","cleanUp":"onlyTab","name":"Visual Studio launch configuration override","type":"pwa-msedge","request":"launch","continueOnDisconnect":true},"seq":2}},"level":0}
{"tag":"dap.send","timestamp":1628178096448,"metadata":{"connectionId":0,"message":{"seq":3,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/launch","data":{"type":"pwa-msedge","request":"launch","os":"win32 x64","nodeVersion":"v12.20.1","adapterVersion":"1.54.2","parameters":"{\"type\":\"pwa-msedge\",\"name\":\"<string>\",\"request\":\"launch\",\"trace\":{\"logFile\":\"<string>\"},\"outputCapture\":\"console\",\"timeout\":60000,\"timeouts\":{},\"showAsyncStacks\":true,\"skipFiles\":[],\"smartStep\":true,\"sourceMaps\":true,\"pauseForSourceMap\":true,\"resolveSourceMapLocations\":null,\"rootPath\":\"<string>\",\"outFiles\":[\"<string>\",\"<string>\"],\"sourceMapPathOverrides\":{\"webpack:///./~/*\":\"<string>\",\"webpack:////*\":\"<string>\",\"webpack://?:*/*\":\"<string>\",\"webpack:///([a-z]):/(.+)\":\"<string>\",\"meteor://💻app/*\":\"<string>\"},\"enableContentValidation\":true,\"cascadeTerminateToConfigurations\":[],\"__workspaceFolder\":\"<string>\",\"__autoExpandGetters\":false,\"__breakOnConditionalError\":false,\"address\":\"localhost\",\"port\":54163,\"disableNetworkCache\":true,\"pathMapping\":{},\"url\":\"<string>\",\"restart\":false,\"urlFilter\":\"*\",\"webRoot\":\"<string>\",\"server\":null,\"browserAttachLocation\":\"workspace\",\"targetSelection\":\"automatic\",\"vueComponentPaths\":[\"<string>\",\"<string>\"],\"perScriptSourcemaps\":\"auto\",\"cwd\":null,\"file\":null,\"env\":{},\"includeDefaultArgs\":true,\"runtimeArgs\":[],\"runtimeExecutable\":\"<string>\",\"userDataDir\":\"<string>\",\"browserLaunchLocation\":\"workspace\",\"profileStartup\":false,\"cleanUp\":\"<string>\",\"useWebView\":false,\"WebRoot\":\"<string>\",\"launchUnelevated\":false,\"projectGuid\":\"<string>\",\"breakOnLoad\":true,\"inspectUri\":\"<string>\",\"continueOnDisconnect\":true}"}}}},"level":0}
{"tag":"dap.send","timestamp":1628178096450,"metadata":{"connectionId":0,"message":{"seq":4,"type":"event","event":"output","body":{"category":"console","output":"Verbose logs are written to:\nC:\\Users\\kah6235_aero\\AppData\\Local\\Temp\\visualstudio-js-debugger.txt\n"}}},"level":0}
{"tag":"dap.receive","timestamp":1628178096542,"metadata":{"connectionId":0,"message":{"type":"request","command":"setBreakpoints","arguments":{"source":{"path":"c:\\Users\\kah6235_aero\\source\\repos\\Blazor\\Blazor.API\\Controllers\\WeatherForecastController.cs","sources":[],"checksums":[]},"breakpoints":[{"line":23,"column":13}],"lines":[23]},"seq":3}},"level":0}
{"tag":"dap.send","timestamp":1628178096543,"metadata":{"connectionId":0,"message":{"seq":5,"type":"response","request_seq":3,"command":"setBreakpoints","success":true,"body":{"breakpoints":[{"id":1,"verified":false,"message":"Unbound breakpoint"}]}}},"level":0}
{"tag":"dap.receive","timestamp":1628178097048,"metadata":{"connectionId":0,"message":{"type":"request","command":"setExceptionBreakpoints","arguments":{"filters":[]},"seq":4}},"level":0}
{"tag":"dap.send","timestamp":1628178097048,"metadata":{"connectionId":0,"message":{"seq":6,"type":"response","request_seq":4,"command":"setExceptionBreakpoints","success":true,"body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1628178097051,"metadata":{"connectionId":0,"message":{"type":"request","command":"configurationDone","arguments":{},"seq":5}},"level":0}
{"tag":"dap.send","timestamp":1628178097051,"metadata":{"connectionId":0,"message":{"seq":7,"type":"response","request_seq":5,"command":"configurationDone","success":true,"body":{}}},"level":0}
{"tag":"runtime.launch","timestamp":1628178098079,"message":"Discovered target URL from /json/version","metadata":{"url":"ws://localhost/devtools/browser/f342153a-43f1-47e4-aa02-be5d1eaebf92","fixed":"ws://localhost:54163/devtools/browser/f342153a-43f1-47e4-aa02-be5d1eaebf92"},"level":0}
{"tag":"dap.send","timestamp":1628178101362,"metadata":{"connectionId":0,"message":{"seq":8,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/dap/operation","data":{"errors":[],"initialize":{"operation":"initialize","totalTime":2,"max":2,"avg":2,"stddev":null,"count":1,"failed":0},"!initialize.errors":[],"initialize.errors":[],"setBreakpoints":{"operation":"setBreakpoints","totalTime":0.6,"max":0.6,"avg":0.6,"stddev":null,"count":1,"failed":0},"!setBreakpoints.errors":[],"setBreakpoints.errors":[],"setExceptionBreakpoints":{"operation":"setExceptionBreakpoints","totalTime":0.5,"max":0.5,"avg":0.5,"stddev":null,"count":1,"failed":0},"!setExceptionBreakpoints.errors":[],"setExceptionBreakpoints.errors":[],"configurationDone":{"operation":"configurationDone","totalTime":0.4,"max":0.4,"avg":0.4,"stddev":null,"count":1,"failed":0},"!configurationDone.errors":[],"configurationDone.errors":[]}}}},"level":0}
{"tag":"runtime.launch","timestamp":1628178156552,"message":"Launch returned error","metadata":{"error":{"message":"Unable to launch browser: \"Could not open ws://localhost:1686/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A54163%2Fdevtools%2Fbrowser%2Ff342153a-43f1-47e4-aa02-be5d1eaebf92\"","stack":"Error: Unable to launch browser: \"Could not open ws://localhost:1686/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A54163%2Fdevtools%2Fbrowser%2Ff342153a-43f1-47e4-aa02-be5d1eaebf92\"\n at x.prepareLaunch (c:\\program files (x86)\\microsoft visual studio\\2019\\professional\\common7\\ide\\commonextensions\\microsoft\\jsdiagnostics\\debugger\\debugAdapter\\out\\src\\targets\\browser\\browserLauncher.js:115:19)"},"wasCancelled":true,"name":"x"},"level":2}
{"tag":"dap.send","timestamp":1628178156553,"metadata":{"connectionId":0,"message":{"seq":9,"type":"response","request_seq":2,"command":"launch","success":false,"body":{"error":{"id":9240,"format":"Unable to launch browser: \"Could not open ws://localhost:1686/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A54163%2Fdevtools%2Fbrowser%2Ff342153a-43f1-47e4-aa02-be5d1eaebf92\"","showUser":false}}}},"level":0}
{"tag":"dap.send","timestamp":1628178156555,"metadata":{"connectionId":0,"message":{"seq":10,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/error","data":{"!error":{"error":{"message":"WebSocket was closed before the connection was established","name":"Error","stack":"Error: WebSocket was closed before the connection was established\n at E.close (websocket.js:220:14)\n at webSocketTransport.js:50:16"}},"error":{"error":{"message":"WebSocket was closed before the connection was established","name":"Error","stack":"Error: WebSocket was closed before the connection was established\n at E.close (websocket.js:220:14)\n at webSocketTransport.js:50:16"}},"exceptionType":"unhandledRejection"}}}},"level":0}
{"tag":"runtime.exception","timestamp":1628178156555,"message":"Unhandled error in debug adapter","metadata":{"message":"WebSocket was closed before the connection was established","stack":"Error: WebSocket was closed before the connection was established\n at E.close (c:\\program files (x86)\\microsoft visual studio\\2019\\professional\\common7\\ide\\commonextensions\\microsoft\\jsdiagnostics\\debugger\\debugAdapter\\node_modules\\ws\\lib\\websocket.js:220:14)\n at c:\\program files (x86)\\microsoft visual studio\\2019\\professional\\common7\\ide\\commonextensions\\microsoft\\jsdiagnostics\\debugger\\debugAdapter\\out\\src\\cdp\\webSocketTransport.js:50:16"},"level":3}
{"tag":"dap.send","timestamp":1628178158563,"metadata":{"connectionId":0,"message":{"seq":11,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/error","data":{"!error":{"error":{"message":"read ECONNRESET","name":"Error","stack":"Error: read ECONNRESET\n at TCP.onStreamRead (internal/stream_base_commons.js:209:20)"}},"error":{"error":{"message":"read ECONNRESET","name":"Error","stack":"Error: read ECONNRESET\n at TCP.onStreamRead (internal/stream_base_commons.js:209:20)"}},"exceptionType":"uncaughtException"}}}},"level":0}
{"tag":"dap.send","timestamp":1628178158564,"message":"Message not sent. Connection was closed.","level":2}
{"tag":"runtime.exception","timestamp":1628178158564,"message":"Unhandled error in debug adapter","metadata":{"message":"read ECONNRESET","stack":"Error: read ECONNRESET\n at TCP.onStreamRead (internal/stream_base_commons.js:209:20)"},"level":3}
{"tag":"dap.send","timestamp":1628178161554,"metadata":{"connectionId":0,"message":{"seq":12,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/dap/operation","data":{"errors":[],"launch":{"operation":"launch","totalTime":60108.4,"max":60108.4,"avg":60108.4,"stddev":null,"count":1,"failed":1},"!launch.errors":[{"error":{"message":"Unable to launch browser: \"Could not open ws://localhost:1686/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A54163%2Fdevtools%2Fbrowser%2Ff342153a-43f1-47e4-aa02-be5d1eaebf92\"","name":"Error","stack":"Error: Unable to launch browser: \"Could not open wlocalhost:1686ws-proxy?browser=ws%3A%2F%2Flocalhost%3A54163%2Fdevtools%2Fbrowser%2Ff342153a-43f1-47e4-aa02-be5d1eaebf92\"\n at x.prepareLaunch (c:browserLauncher.js:115:19)"}}],"launch.errors":[{"error":{"message":"Unable to launch browser: \"Could not open ws://localhost:1686/_framework/debug/ws-proxy?browser=ws%3A%2F%2Flocalhost%3A54163%2Fdevtools%2Fbrowser%2Ff342153a-43f1-47e4-aa02-be5d1eaebf92\"","name":"Error","stack":"Error: Unable to launch browser: \"Could not open wlocalhost:1686ws-proxy?browser=ws%3A%2F%2Flocalhost%3A54163%2Fdevtools%2Fbrowser%2Ff342153a-43f1-47e4-aa02-be5d1eaebf92\"\n at x.prepareLaunch (c:browserLauncher.js:115:19)"}}]}}}},"level":0}
{"tag":"dap.send","timestamp":1628178161554,"message":"Message not sent. Connection was closed.","level":2}
Your config probably needs some attention. In the sections you've labelled Blazor and API they are serving on the same ports: 5000/5001.
You wrote that you are using Edge - for a working config see my answer here.

visual studio docker template container running throgh command line but not being found when searched in the browser

I created solution with VS for an .net core API, and enabled Docker Support for Linux containers, also enabled OpenAPI support. I even have other version with docker-compose support.
Both versions, Im able to run the containers in the Visual studio and the browser immediately pops with everything ok.
The problem is I need to zip and send it and people must be able to run it without VS, just by running a container throgh the command line...
This are the files generated without docker-compose:
Dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
WORKDIR /src
COPY ["PhoneNumberAggregator/PhoneNumberAggregator.csproj", "PhoneNumberAggregator/"]
RUN dotnet restore "PhoneNumberAggregator/PhoneNumberAggregator.csproj"
COPY . .
WORKDIR "/src/PhoneNumberAggregator"
RUN dotnet build "PhoneNumberAggregator.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "PhoneNumberAggregator.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "PhoneNumberAggregator.dll"]
launchSettings.json:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:60906",
"sslPort": 44316
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"PhoneNumberAggregator": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": "true",
"applicationUrl": "https://localhost:5001;http://localhost:5000"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"publishAllPorts": true,
"useSSL": true
}
}
}
And this are the files generated with docker-compose (counting with the above):
this are available in VS:
docker-compose.yml(in this file I added ports: -8080:443 to when it launches in VS goes in localhost:8080):
version: '3.4'
services:
phonenumberaggregator:
image: ${DOCKER_REGISTRY-}phonenumberaggregator
build:
context: .
dockerfile: PhoneNumberAggregator/Dockerfile
ports:
- "8080:443"
and .dockerignore:
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
still in the docker-composer version but not available in VS I have the following files:
in solution folder:
docker-compose.dcproj:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
<PropertyGroup Label="Globals">
<ProjectVersion>2.1</ProjectVersion>
<DockerTargetOS>Linux</DockerTargetOS>
<ProjectGuid>39323510-da14-4594-918a-c8300beaa110</ProjectGuid>
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}/swagger</DockerServiceUrl>
<DockerServiceName>phonenumberaggregator</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
<None Include=".dockerignore" />
</ItemGroup>
</Project>
and docker-compose.override.yml:
version: '3.4'
services:
phonenumberaggregator:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
ports:
- "80"
- "443"
volumes:
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
and in both versions I have inside the project this file:
PhoneNumberAggregator.csproj.user:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugProfile>Docker</ActiveDebugProfile>
<Controller_SelectedScaffolderID> ApiControllerWithActionsScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath> root/Common/Api</Controller_SelectedScaffolderCategoryPath>
</PropertyGroup>
</Project>
By the way in VS when its running I see this Ports
For Docker version:
For docker-compose version:
It looks like port 8080 is mapped to port 443
port 433 is https so make sure you should are using https://localhost:8080 or https://127.0.0.1:8080

IIS Express Ports - Multiple Ports in File

Dumb question, but I cannot find it. Why does IIS express use 2 ports (Sample file below).
Secondly, in this exercise here, when I'm requested to setup an app, it references 3007, which I cannot access.
https://learn.microsoft.com/en-us/learn/modules/identity-application-types/5-exercise-web-apps-call-apis
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "https://localhost:3007",
"sslPort": 3007
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IdentityWeb": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
iisSettings is used when running VS2019 or other visual studio version IDE.
IdentityWeb(peojectname) is for dotnet command line use.
Offical doc: Development and launchSettings.json
These are just different configurations of the project according to the operating environment, no need to entangle.
Test steps.
Delete iisSettings in vs2019, then change properties, then check launchSettings.json file.
Before deleted the ssl port is 44316, then we delete it. After changed properties, it generated new ssl port.
Now, we can run project(we need to restart IDE [vs2019]), it works fine.
Modify applicationUrl in IdentityWeb.
Open cmd or powershell in project folder.

Visual Studio Console Debug Popup

I've been running some Quickstart samples from IdentityServer4 and found that when I run a web site (e.g. the IdentityServer)... a popup shows up with messages... I am assuming it's either a logger window or the console output... but I have poked around and have no idea how this is done.
Any help?
So... I quickly made a project called test as an example... and in the Properties/launchSettings.json... there were two items under profiles (IIS Express and test)... then when I choose this project there is now, in 2019 at least (maybe I never noticed it before), a new combo box where I can choose between IIS Express and test... when I choose IIS Express it just shows the browser... but when I choose test it shows the browser and a command box with I believe console debugging info.
This maybe be referred to as Self Hosted, but not 100% sure.
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:52015",
"sslPort": 44344
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"test": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

Solution-wide launchSettings.json

I was wondering what currently the best practise is to gain a solution-wide strongly-typed launchSettings.json inside a solution with web projects (aspnetcore 2.0).
For a single project this doesn't really seem like a problem.
However, for a solution with 3 web projects (client/api/sts) this does seem possible/easy thing to do.
The reason for me asking this is that, for example, the client needs the applicationUrl from the sts and api. The same applies for the sts and api, they all need to know each others location. This combined with a changing applicationUrl for different profiles makes it look like that I kinda have to hardcode magic strings for the urls everywhere. Thus not allowing a single source of truth.
launchSettings.json (currently: x3 -> per web project, goal: 3 urls being reused)
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:5000/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"BuildStuff.Client": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000/"
}
}
}
Thanks in advance, guidance in the right direction is all I seek.

Resources