95 writes to Url
Aspire.Hosting (16)
ApplicationModel\ResourceUrlAnnotation.cs (1)
46
Url
= Url,
ApplicationModel\ResourceUrlsEditor.cs (1)
88
Url
= url,
Dashboard\DashboardEventHandlers.cs (1)
317
url.
Url
= $"{url.Url}/login?t={browserToken}";
Orchestrator\ApplicationOrchestrator.cs (7)
351
var url = new ResourceUrlAnnotation {
Url
= allocatedEndpoint.UriString, Endpoint = endpointReference };
364
Url
= $"{allocatedEndpoint.UriScheme}://{endpoint.TargetHost}:{allocatedEndpoint.Port}",
373
Url
= $"{allocatedEndpoint.UriScheme}://{Environment.MachineName}:{allocatedEndpoint.Port}",
406
Url
= $"{allocatedEndpoint.UriScheme}://{resource.Name.ToLowerInvariant()}-{subdomainSuffix}.dev.localhost:{allocatedEndpoint.Port}",
524
url.
Url
= uriBuilder.Uri.ToString();
560
url.
Url
= allocatedEndpoint.UriString.TrimEnd('/') + url.Url;
578
url.
Url
= rewrittenUrl;
ProjectResourceBuilderExtensions.cs (2)
851
url.
Url
= launchProfile.LaunchUrl;
857
url.
Url
= (new Uri(baseUri, launchUri)).ToString();
ResourceBuilderExtensions.cs (4)
2382
u.
Url
= uri.ToString();
2390
return builder.WithAnnotation(new ResourceUrlAnnotation {
Url
= url, DisplayText = displayText });
2463
c.Urls.Add(new() { Endpoint = endpoint,
Url
= urlValue, DisplayText = displayText });
2628
url = new ResourceUrlAnnotation {
Url
= "/", Endpoint = endpoint };
Aspire.Hosting.Azure.EntraId.Tests (7)
EntraIdProvisioningTests.cs (7)
1167
web.WithUrlForEndpoint("https", url => url.
Url
= "https://web.dev.localhost:7081/swagger?x=1#top");
1277
web.WithUrlForEndpoint("https", url => url.
Url
= "https://web-hashr.dev.localhost:7081");
1302
web.WithUrlForEndpoint("https", url => url.
Url
= "https://web.dev.localhost:7081/swagger")
1305
Url
= "https://public.example:9443/home",
1331
context.Urls[0].
Url
= "https://web.example/home";
1450
web.WithUrlForEndpoint("https", url => url.
Url
= "/swagger");
1483
Url
= "https://other.dev.localhost:7082",
Aspire.Hosting.Azure.Tests (2)
AzureCosmosDBExtensionsTests.cs (2)
1248
new() {
Url
= "http://localhost:8080", Endpoint = cosmos.GetEndpoint("emulatorhealth") }
1273
new() {
Url
= "http://localhost:1234", Endpoint = cosmos.GetEndpoint("data-explorer") }
Aspire.Hosting.DevTunnels (3)
DevTunnelResourceBuilderExtensions.cs (3)
669
tunnelUrl.
Url
= new UriBuilder(tunnelUrl.Url).Uri.ToString().TrimEnd('/');
692
Url
= inspectUrlString,
742
url.
Url
= UpdatePortUrl(url.Url, url.Endpoint?.EndpointName, url.DisplayText, previousAddress, portUri);
Aspire.Hosting.DevTunnels.Tests (4)
DevTunnelMonitorTests.cs (3)
264
tunnelUrl.
Url
+= "/swagger?x=1#operations";
268
Url
= "https://original-3000.usw2.devtunnels.ms/health"
273
Url
= "https://custom.example/app"
DevTunnelResourceBuilderExtensionsTests.cs (1)
781
context.Urls.Add(new() {
Url
= "https://example.com/diagnostics", DisplayText = "Custom diagnostics" });
Aspire.Hosting.Foundry (1)
HostedAgent\HostedAgentBuilderExtension.cs (1)
309
http.
Url
= new UriBuilder(http.Url)
Aspire.Hosting.Foundry.Tests (1)
HostedAgentExtensionTests.cs (1)
146
Url
= "http://localhost:1234",
Aspire.Hosting.Qdrant (1)
QdrantBuilderExtensions.cs (1)
102
.WithUrlForEndpoint(QdrantServerResource.HttpEndpointName, e => new ResourceUrlAnnotation() {
Url
= "/dashboard", DisplayText = "Manage", DisplayOrder = 1 });
Aspire.Hosting.Tests (56)
Dashboard\DashboardResourceTests.cs (2)
854
new() {
Url
= "http://localhost:5003", Endpoint = ((IResourceWithEndpoints)dashboard).GetEndpoint("http") },
855
new() {
Url
= "https://localhost:5005", Endpoint = ((IResourceWithEndpoints)dashboard).GetEndpoint("https") }
Dcp\DcpExecutorTests.cs (2)
5201
url.
Url
= "https://frontend.example/app";
5208
url.
Url
= "https://backend.example/app";
EndpointReferenceTests.cs (16)
527
new() {
Url
= "https://localhost:8443/original" },
528
new() {
Url
= "https://public.example/path" },
529
new() {
Url
= "https://alias.example/home" },
530
new() {
Url
= "https://public.example/duplicate" }
559
endpoint.EndpointAnnotation.BrowserUrlsSnapshot.SetValue([new() {
Url
= "https://frontend.example/path" }]);
575
resource.GetEndpoint("http").EndpointAnnotation.BrowserUrlsSnapshot.SetValue([new() {
Url
= "http://frontend.example" }]);
576
resource.GetEndpoint("https").EndpointAnnotation.BrowserUrlsSnapshot.SetValue([new() {
Url
= "https://separate.example" }]);
589
host.EndpointAnnotation.BrowserUrlsSnapshot.SetValue([new() {
Url
= "https://public.example/app" }]);
608
new() {
Url
= "http://preferred.example:8080/app" },
609
new() {
Url
= "https://frontend.example/app" },
610
new() {
Url
= "https://frontend.example:443/swagger" },
611
new() {
Url
= "https://127.0.0.1:8443/" },
612
new() {
Url
= "https://frontend.example:9443/" }
628
endpoint.EndpointAnnotation.BrowserUrlsSnapshot.SetValue([new() {
Url
= url }]);
663
endpoint.EndpointAnnotation.BrowserUrlsSnapshot.SetValue([new() {
Url
= "https://frontend.example/app" }]);
677
endpoint.EndpointAnnotation.BrowserUrlsSnapshot.SetValue([new() {
Url
= "https://local.example" }]);
Orchestrator\ApplicationOrchestratorTests.cs (16)
67
.WithUrlForEndpoint("http", url => url.
Url
= "https://first.example/app");
170
.WithUrlForEndpoint("http", url => url.
Url
= "/path?x=1#fragment")
171
.WithUrlForEndpoint("http", _ => new() {
Url
= "http://localhost:8080/secondary", DisplayLocation = UrlDisplayLocation.DetailsOnly });
206
.WithUrlForEndpoint("http", url => url.
Url
= "https://custom.example/path?x=1#fragment")
207
.WithUrlForEndpoint("http", _ => new() {
Url
= "http://localhost:8080/secondary", DisplayLocation = UrlDisplayLocation.DetailsOnly });
237
context.Urls[0].
Url
= "https://frontend.example/app";
295
frontend.WithUrlForEndpoint("http", url => url.
Url
= customUrl);
346
.WithUrlForEndpoint("http", url => url.
Url
= "https://frontend.example/app")
347
.WithUrlForEndpoint("http", _ => new() {
Url
= "https://frontend.example/swagger" })
348
.WithUrlForEndpoint("http", _ => new() {
Url
= "https://admin.example", DisplayOrder = 1000 })
351
.WithUrlForEndpoint(frontend.GetEndpoint("http"), url => url.
Url
= "https://manager.example/admin");
377
context.Urls[0].
Url
= "https://frontend.example/app";
413
Url
= "https://frontend.example/app",
459
.WithUrlForEndpoint("http", url => url.
Url
= invalidUrl)
461
.WithUrlForEndpoint("https", url => url.
Url
= "https://frontend.example/home");
510
context.Urls[0].
Url
= "https://frontend.example/app";
WithUrlsTests.cs (20)
49
Url
= "https://example.com",
189
Url
= "http://localhost:8080"
217
Url
= "http://localhost:8080"
371
.WithUrls(c => c.Urls.Add(new() {
Url
= "https://example.com", DisplayText = "Example" }))
575
u.
Url
= "https://example.com";
605
.WithUrlForEndpoint("http", u => u.
Url
= "https://example.com");
772
c.Urls.Add(new() {
Url
= "http://example.com/", DisplayLocation = UrlDisplayLocation.SummaryAndDetails });
773
c.Urls.Add(new() {
Url
= "http://example.com/internal", DisplayLocation = UrlDisplayLocation.DetailsOnly });
774
c.Urls.Add(new() {
Url
= "http://example.com/out-of-range", DisplayLocation = (UrlDisplayLocation)100 });
837
return new() {
Url
= "https://example.com" };
863
.WithUrls(c => c.Urls.Add(new() {
Url
= "https://callback-before.com/sub-path", DisplayText = "Example" }))
866
.WithUrls(c => c.Urls.Add(new() {
Url
= "https://callback-after.com/sub-path" })) // This won't get updated because it's added after the relative URL
925
url.
Url
= "/test-sub-path";
958
url.
Url
= "/test-sub-path";
964
Url
= "/test-another-sub-path",
1006
return new() {
Url
= "/sub-path" };
1036
url.
Url
= "/admin";
1068
c.Urls.Add(new() { Endpoint = c.GetEndpoint("test"),
Url
= "/sub-path" });
1105
Url
= "/",
1157
Url
= "/",
Stress.AppHost (1)
AppHost.cs (1)
87
.WithUrls(c => c.Urls.Add(new() {
Url
= "https://someplace.com", DisplayText = "Some place" }))
TestShop.AppHost (3)
AppHost.cs (3)
148
u.
Url
= "/";
154
Url
= "/swagger",
191
.WithUrlForEndpoint("https", ep => new() {
Url
= "/health", DisplayText = "Health", DisplayLocation = UrlDisplayLocation.DetailsOnly })
86 references to Url
Aspire.Hosting (29)
ApplicationModel\EndpointReference.cs (1)
420
var origins = urls.Select(url => new Uri(url.
Url
, UriKind.Absolute))
ApplicationModel\ResourceUrlAnnotation.cs (1)
46
Url =
Url
,
Dashboard\DashboardEventHandlers.cs (1)
317
url.Url = $"{url.
Url
}/login?t={browserToken}";
Dcp\ResourceSnapshotBuilder.cs (3)
592
Url: endpointUrl.
Url
,
620
new(Name: endpointName, Url: endpointUrl.
Url
, IsInternal: endpointUrl.IsInternal)
631
new(Name: null, Url: url.
Url
, IsInternal: url.IsInternal)
Orchestrator\ApplicationOrchestrator.cs (21)
238
urls = resourceUrls.Select(url => new UrlSnapshot(Name: url.Endpoint?.EndpointName, Url: url.
Url
, IsInternal: url.DisplayLocation == UrlDisplayLocation.DetailsOnly)
432
_logger.LogTrace("Added URL '{Url}' for endpoint '{EndpointName}' on resource '{ResourceName}'.", url.
Url
, endpoint.Name, resource.Name);
439
_logger.LogTrace("Added additional URL '{Url}' for endpoint '{EndpointName}' on resource '{ResourceName}'.", additionalUrl.
Url
, endpoint.Name, resource.Name);
453
_logger.LogTrace("Added static URL '{Url}' for resource '{ResourceName}'.", staticUrl.
Url
, resource.Name);
503
Uri.TryCreate(primaryUrl.
Url
, UriKind.RelativeOrAbsolute, out var primaryUri);
504
var primaryPath = primaryUri?.IsAbsoluteUri == true ? primaryUri.AbsolutePath : primaryUrl.
Url
;
511
_logger.LogTrace("Applying path '{Path}' from URL '{Url}' for primary launch profile endpoint '{EndpointName}' to other launch profile endpoints for resource '{ResourceName}'.", primaryPath, primaryUrl.
Url
, primaryLaunchProfileEndpoint.Name, resource.Name);
516
&& !string.Equals(url.
Url
, primaryUrl.
Url
, StringComparisons.Url)
517
&& Uri.IsWellFormedUriString(url.
Url
, UriKind.Absolute))
521
_logger.LogTrace("Updating URL '{Url}' with path '{Path}' for launch profile endpoint '{EndpointName}' for resource '{ResourceName}'.", url.
Url
, primaryPath, url.Endpoint.EndpointName, resource.Name);
523
var uriBuilder = new UriBuilder(url.
Url
) { Path = primaryPath };
527
_logger.LogTrace("Updated URL to '{Url}' for launch profile endpoint '{EndpointName}' on resource '{ResourceName}'.", url.
Url
, url.Endpoint.EndpointName, resource.Name);
536
_logger.LogTrace("URL '{Url}' for primary launch profile endpoint '{EndpointName}' for resource '{ResourceName}' does not have a path to apply to other launch profile endpoints.", primaryUrl.
Url
, primaryLaunchProfileEndpoint.Name, resource.Name);
558
if (url.
Url
.StartsWith('/') && endpoint.AllocatedEndpoint is { } allocatedEndpoint)
560
url.Url = allocatedEndpoint.UriString.TrimEnd('/') + url.
Url
;
563
_logger.LogTrace("Converted relative URL to absolute URL '{Url}' for endpoint '{EndpointName}' on resource '{ResourceName}'.", url.
Url
, endpoint.EndpointName, resource.Name);
576
codespacesRewriter.TryRewriteResourceUrl(url.
Url
, out var rewrittenUrl))
608
_logger.LogTrace("Added URL annotation '{Url}' to resource '{ResourceName}'.", url.
Url
, resource.Name);
629
if (!Uri.TryCreate(url.
Url
, UriKind.Absolute, out var uri))
632
"URL '{Url}' for resource '{ResourceName}' is not absolute and cannot provide a browser origin.", url.
Url
, resource.Name);
ProjectResourceBuilderExtensions.cs (1)
856
var baseUri = new Uri(url.
Url
);
ResourceBuilderExtensions.cs (1)
2379
if (Uri.TryCreate(u.
Url
, UriKind.Absolute, out var absoluteUri)
Aspire.Hosting.DevTunnels (4)
DevTunnelResourceBuilderExtensions.cs (4)
667
&& !string.Equals(new UriBuilder(u.
Url
).Host, "localhost")) is { } tunnelUrl)
669
tunnelUrl.Url = new UriBuilder(tunnelUrl.
Url
).Uri.ToString().TrimEnd('/');
675
&& string.Equals(new UriBuilder(u.
Url
).Host, "localhost", StringComparison.OrdinalIgnoreCase)) is { } localhostTunnelUrl)
742
url.Url = UpdatePortUrl(url.
Url
, url.Endpoint?.EndpointName, url.DisplayText, previousAddress, portUri);
Aspire.Hosting.Foundry (1)
HostedAgent\HostedAgentBuilderExtension.cs (1)
309
http.Url = new UriBuilder(http.
Url
)
Aspire.Hosting.Foundry.Tests (1)
HostedAgentExtensionTests.cs (1)
158
Assert.Equal("http://localhost:1234/invocations", url.
Url
);
Aspire.Hosting.Qdrant.Tests (1)
QdrantFunctionalTests.cs (1)
250
Assert.Single(urls, u => u.DisplayText == "Manage" && u.
Url
.EndsWith("/dashboard"));
Aspire.Hosting.Redis.Tests (2)
AddRedisTests.cs (2)
313
Assert.Equal("/", managementUrl.
Url
);
339
Assert.Equal("/", managementUrl.
Url
);
Aspire.Hosting.Tests (48)
Dashboard\DashboardResourceTests.cs (2)
870
Assert.Equal(expectedHttpUrl, httpUrl.
Url
);
874
Assert.Equal(expectedHttpsUrl, httpsUrl.
Url
);
Orchestrator\ApplicationOrchestratorTests.cs (6)
193
frontend.Resource.Annotations.OfType<ResourceUrlAnnotation>().Select(url => url.
Url
));
217
frontend.Resource.Annotations.OfType<ResourceUrlAnnotation>().Select(url => url.
Url
));
332
Assert.Equal(customUrl.StartsWith('/') ? $"http://localhost:8080{customUrl}" : customUrl, primaryUrl.
Url
);
336
Assert.Equal(expectedOrigin, new Uri(primaryUrl.
Url
).GetLeftPart(UriPartial.Authority));
363
Assert.Equal("https://manager.example/admin", Assert.Single(manager.Resource.Annotations.OfType<ResourceUrlAnnotation>()).
Url
);
476
frontend.Resource.Annotations.OfType<ResourceUrlAnnotation>().Select(url => url.
Url
));
WithEndpointTests.cs (4)
1071
url => Assert.StartsWith("https://example.localhost:", url.
Url
),
1072
url => Assert.StartsWith("https://localhost:", url.
Url
));
1105
url => Assert.StartsWith("https://localhost:", url.
Url
),
1106
url => Assert.StartsWith($"https://{Environment.MachineName}:", url.
Url
));
WithUrlsTests.cs (36)
383
Assert.Single(urls, u => u.
Url
== "https://example.com" && u.DisplayText == "Example");
407
Assert.Single(urls, u => u.
Url
== "https://example.com" && u.DisplayText == "Example");
435
u => Assert.True(u.
Url
== endpointUrl.
Url
&& u.DisplayText is null),
436
u => Assert.True(u.
Url
.EndsWith("/test") && u.DisplayText == "Example")
461
Assert.Single(urls, u => u.
Url
.StartsWith("http://localhost") && u.Endpoint?.EndpointName == "test");
497
Assert.StartsWith($"http://{projectB.Resource.Name.ToLowerInvariant()}{expectedHostSuffix}", u.
Url
);
498
Assert.EndsWith("/sub-path", u.
Url
);
505
Assert.StartsWith("http://localhost", u.
Url
);
511
Assert.StartsWith("tcp://localhost", u.
Url
);
537
Assert.Single(urls, u => u.
Url
.EndsWith("/sub-path") && u.Endpoint?.EndpointName == "http");
560
Assert.Single(urls, u => u.
Url
== "http://custom.localhost:23456/home" && u.Endpoint?.EndpointName == "http");
591
u.
Url
== "https://example.com"
879
var staticBeforeUrl = allUrls.FirstOrDefault(u => u.Endpoint is null && u.
Url
.StartsWith("https://static-before.com"));
880
var callbackBeforeUrl = allUrls.FirstOrDefault(u => u.Endpoint is null && u.
Url
.StartsWith("https://callback-before.com"));
881
var staticAfter = allUrls.FirstOrDefault(u => u.Endpoint is null && u.
Url
.StartsWith("https://static-after.com"));
882
var callbackAfter = allUrls.FirstOrDefault(u => u.Endpoint is null && u.
Url
.StartsWith("https://callback-after.com"));
886
Assert.True(endpointUrl.
Url
.StartsWith("http://localhost") && endpointUrl.
Url
.EndsWith("/test"));
889
Assert.Equal("https://static-before.com/test", staticBeforeUrl.
Url
);
892
Assert.Equal("https://callback-before.com/test", callbackBeforeUrl.
Url
);
895
Assert.Equal("https://static-after.com/test", staticAfter.
Url
);
898
Assert.Equal("https://callback-after.com/sub-path", callbackAfter.
Url
);
941
Assert.StartsWith(useHttps ? "https://localhost" : "http://localhost", endpointUrl.
Url
);
942
Assert.EndsWith("/test-sub-path", endpointUrl.
Url
);
981
Assert.StartsWith("http://localhost", url.
Url
);
982
Assert.EndsWith("/test-sub-path", url.
Url
);
987
Assert.StartsWith("http://localhost", url.
Url
);
988
Assert.EndsWith("/test-another-sub-path", url.
Url
);
1018
var endpointUrl = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>().FirstOrDefault(u => u.Endpoint?.EndpointName == "test" && u.
Url
.EndsWith("/sub-path"));
1021
Assert.True(endpointUrl.
Url
.StartsWith("http://localhost") && endpointUrl.
Url
.EndsWith("/sub-path"));
1053
Assert.Equal($"{manager.GetEndpoint("http").Url.TrimEnd('/')}/admin", url.
Url
);
1080
var endpointUrl = projectA.Resource.Annotations.OfType<ResourceUrlAnnotation>().FirstOrDefault(u => u.Endpoint?.EndpointName == "test" && u.
Url
.EndsWith("/sub-path"));
1083
Assert.True(endpointUrl.
Url
.StartsWith("http://localhost") && endpointUrl.
Url
.EndsWith("/sub-path"));