我有一个非常简单的2行控制台应用程序(.net 6),在创建Uri
时,
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
var uri = new Uri("https://learn.microsoft.com/windows/msix/app-installer/update-settings");
我得到了以下例外。我一定是在做一些很傻的事,但我想不出来。我也尝试过简单的urls,结果也是一样。
System.UriFormatException
HResult=0x80131537
Message=Invalid URI: The URI scheme is not valid.
Source=System.Private.Uri
StackTrace:
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
at System.Uri..ctor(String uriString)
at Program.<Main>$(String[] args) in C:\Users\user\source\repos2\ConsoleApp1\ConsoleApp1\Program.cs:line 3
发布于 2022-04-20 06:23:48
字符串中有一个额外的符号(不在这里显示在SO上)。这是在抄袭你的问题之后:
在https
之前删除此符号,它将工作。
https://stackoverflow.com/questions/71934972
复制相似问题