我一直致力于将我们的 Azure Functions 实现之一升级到 .net 5。我已经与许多恶魔作斗争了,但正当我以为我已经整理了所有配置和依赖项注入更改时,它向我抛出了一个曲线球。host.RunAsync在之后,Main我得到了以下异常,我对罪魁祸首有点不知所措。有没有人遇到过并解决了这个问题?
System.UriFormatException
HResult=0x80131537
Message=Invalid URI: The hostname could not be parsed.
Source=System.Private.Uri
StackTrace:
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at Grpc.Net.Client.GrpcChannel.ForAddress(String address, GrpcChannelOptions channelOptions)
at Microsoft.Extensions.DependencyInjection.GrpcServiceCollectionExtensions.<>c.<AddGrpc>b__1_1(IServiceProvider p) in D:\a\1\s\src\DotNetWorker.Grpc\GrpcServiceCollectionExtensions.cs:line 58
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at …Run Code Online (Sandbox Code Playgroud) 我使用与此类似的方法从图像列表中计算了平均颜色。我现在有一个列表System.Drawing.Color,但我不知道如何以看起来像彩虹的方式对它们进行排序。
这是我尝试过的简单方法(出于示例目的略有改变):
var colorList = new List<Color>
{
Color.Red,
Color.Purple,
Color.Black,
Color.Blue,
Color.Green,
Color.LightGreen,
Color.LightSkyBlue,
Color.Yellow
};
var orderedColorList =
colorList.OrderBy(o => (o.R * 3 + o.G * 2 + o.B * 1));
Run Code Online (Sandbox Code Playgroud)
这似乎并没有创造出彩虹,而更多的是从黑到白的效果。
我怎样才能以形成彩虹的方式对它们进行排序?