- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我最近获得了一台 Mac M1,并且正在设置我的计算机以进行 Azure Function(dotnet-isolated)开发。
我按照以下文档进行操作,该文档在我的 Windows 10 计算机上运行得非常好。 https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-csharp?tabs=azure-cli%2Cisolated-process
以下是 Mac 中的设置,
% func --版本4.0.4895
% dotnet --list-sdks6.0.403 [/usr/local/share/dotnet/sdk]
% azure-functions-core-tools@4
% az --版本azure-cli 2.42.0
核心2.42.0遥测1.0.8
依赖关系:MSAL 1.20.0 azure 管理资源21.1.0b1
完成上述安装后,使用以下命令创建一个新函数
% func new --template "Http Trigger"--name MyHttpTrigger
然后当我尝试使用启动该功能时% 函数开始
我收到以下错误......
MyHttpTrigger: [GET,POST] http://localhost:7071/api/MyHttpTrigger
For detailed output, run func with --verbose flag.
[2022-11-30T09:21:10.868Z] Unhandled exception. Grpc.Core.RpcException: Status(StatusCode="Unavailable", Detail="Error starting gRPC call. HttpRequestException: An error occurred while sending the request. IOException: An HTTP/2 connection could not be established because the server did not complete the HTTP/2 handshake. IOException: Unable to write data to the transport connection: Broken pipe. SocketException: Broken pipe", DebugException="System.Net.Http.HttpRequestException: An error occurred while sending the request.
[2022-11-30T09:21:10.868Z] ---> System.IO.IOException: An HTTP/2 connection could not be established because the server did not complete the HTTP/2 handshake.
[2022-11-30T09:21:10.868Z] ---> System.IO.IOException: Unable to write data to the transport connection: Broken pipe.
[2022-11-30T09:21:10.868Z] ---> System.Net.Sockets.SocketException (32): Broken pipe
[2022-11-30T09:21:10.868Z] at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.CreateException(SocketError error, Boolean forAsyncThrow)
csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.8.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.7.0" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />
</ItemGroup>
</Project>
程序.cs
using Microsoft.Extensions.Hosting;
var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
.Build();
host.Run();
功能
using System.Net;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Extensions.Logging;
namespace LocalFunctionProj
{
public class MyHttpTrigger
{
private readonly ILogger _logger;
public MyHttpTrigger(ILoggerFactory loggerFactory)
{
_logger = loggerFactory.CreateLogger<MyHttpTrigger>();
}
[Function("MyHttpTrigger")]
public HttpResponseData Run([HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequestData req)
{
_logger.LogInformation("C# HTTP trigger function processed a request.");
var response = req.CreateResponse(HttpStatusCode.OK);
response.Headers.Add("Content-Type", "text/plain; charset=utf-8");
response.WriteString("Welcome to Azure Functions!");
return response;
}
}
}
本地.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
}
}
launchSettings.json
{
"profiles": {
"LocalFunctionProj": {
"commandName": "Project",
"commandLineArgs": "--port 7146",
"launchBrowser": false
}
}
}
请对我在这里缺少的内容有任何意见吗?
最佳答案
我知道这已经晚了,但是,我最近也遇到了这个问题,结果是我的 Program.cs 中的调用顺序问题。简而言之,我在 ConfigureAppConfiguration 之前调用了 ConfigureFunctionsWorkerDefaults。在这件事上,我用头撞墙的时间比我愿意承认的要长得多。一旦我改变了调用顺序,一切都很好。例如:
var host = new HostBuilder()
.ConfigureAppConfiguration(builder => builder.AddEnvironmentVariables())
.ConfigureFunctionsWorkerDefaults()
.Build();
希望这对其他人有帮助。
关于c# - Azure 函数(dotnet-isolated)无法启动,并出现 Grpc.Core.RpcException : StatusCode ="Unavailable" - Mac M1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74625626/
关于 gRPC Health Checking ,如果 gRPC 服务托管在与其他也需要健康检查的 HTTP 服务相同的端口上,则对 grpc.health.v1.Health.Check 的响应应该
我的项目是读取服务器中的图像,进行一些处理,然后将整个图像传递给客户端。客户端占用图像并进行更多处理,并将一些输出值返回给服务器。服务器和客户端之间使用的图像大小为 [640x480x3]。 以下是我
gRPC 基于 HTTP/2,它(假设)被浏览器广泛支持。因此,我觉得从浏览器使用 gRPC 应该没有问题。 但是,很明显存在问题。协议(protocol),grpc web , 是不同的,因为“由于
关于服务器端代码的幂等性的问题,或者说它的必要性。对于一般的 gRPC,或者专门针对 java 实现。 当我们从客户端发送消息一次时,是否有可能由我们的服务实现处理两次?也许这与服务似乎不可用时的重试
假设我想使用 Grpc Server 流式传输或双向流式传输。 考虑到它在底层使用 http/2,流可以持续多长时间是否有任何限制? 如果是的话,它可以用来代替消息总线,这样流就可以打开并存活多久?
使用 gRPC 向客户端发送有关错误的更多详细信息的模式是什么? 例如,假设我有一个用于注册用户的表单,用于发送消息 message RegisterUser { string email = 1
我是 GRPC 的新手。我想知道当 GRPC 客户端启动一个请求时,服务器是否启动一个新线程来处理。 最佳答案 最多可能有一个 Runnable加入 Server's executor用于申请处理。每
我想传输一个 int64 数组。 我查了一下如何使用它。在我的原型(prototype)文件中,我需要一个流: service myService { rpc GetValues(myRequ
通常,客户端可以通过以下方式取消 gRPC 调用: (requestObserver as ClientCallStreamObserver) .cancel("Cancelled", nul
在 100Gb 网络上,我创建了一个服务器来监听 4 个端口,grpc 客户端可以达到 3GB+/s 的吞吐量。然而,当服务器监听一个端口时,grpc 客户端达到了 1GB/s 的吞吐量,即使我设置了
我想验证调用并可能在服务器拦截器中回答错误。有没有办法做到这一点?如果是,我该如何实现? 最佳答案 简单地从拦截器响应 RPC,可能通过调用 close() ,不要调用next .您仍然需要返回一个监
我有一个 GRPC API,经过重构,一些包被重命名。这包括我们定义 API 的原型(prototype)文件之一中的 package 声明。像这样的: package foo; service Ba
我想在 Ubuntu 上使用源代码中的所有子模块编译 grpc,并将其安装到/usr/local 以外的指定位置 为提供的 Makefile 指定此位置的方法是什么(类似于配置脚本的 --prefix
我不断在控制台中收到此警告: DeprecationWarning: grpc.load: Use the @grpc/proto-loader module with grpc.loadPackag
上下文 我正在尝试使用 Google 的 Cloud Natural Language API。我有我的服务帐户 key JSON 文件,并且正在尝试编写一个简单的 .NET Core 应用程序(更具
用户在测试中遇到了此崩溃。我的第一个猜测是这与内存有关,但除此之外我没有什么可做的。更深入地研究代码,我认为这可能是主线程问题,但看起来监听器在后台线程上被删除,所以我怀疑这就是原因。 我认为在应用程
我正在编写一个 grpc 服务并在 Kubernetes (https://github.com/grpc-ecosystem/grpc-health-probe) 上使用 gRPC 健康检查。在我的
如何使用 gRPC-java 实现检测网络错误并尝试从中恢复的策略?我知道 UNAVAILABLE 状态可能意味着网络错误,但这并没有告诉我它是哪种网络错误 - 并且 UNAVAILABLE 也可以从
假设我们有一个 Search-Service service Search { rpc Search (SearchRequest) returns (SearchReply) {} } mess
如果浏览器支持http/2,为什么 grpc-web 需要 envoy 代理? 不支持 http/2 的旧浏览器是否只需要它? 最佳答案 回答于 https://github.com/grpc/grp
我是一名优秀的程序员,十分优秀!