出于某种原因,当ASP.NET核心控制器在单独的程序集中创建时,TestServer在客户端发出请求时无法找到控制器操作.(导致404响应)为什么会这样?我该如何解决这个问题?以下是重现的步骤.
请参阅以下链接以创建集成测试.使用ASP.NET Core进行集成测试
c# unit-testing asp.net-web-api asp.net-core-mvc asp.net-core
如果我没记错的话,Azure Devops 设置为添加一项功能,允许将发布管道放入 yaml 中,类似于构建管道。这个功能现在可用吗?
我希望获得有关将遗留经典发布管道迁移到新格式的指导?
更新:看起来我只落后了大约 4 个月。发表于 2019 年 5 月 6 日
通过我们的新更新,开发团队现在可以利用相同的 YAML 文档为持续集成和持续交付构建多阶段管道即代码。这是我们客户最大的要求之一
对于像我这样的人来说,这里有一些有用的链接:手动创建了许多经典的发布管道,对新格式感兴趣。
https://azure.microsoft.com/en-us/updates/unified-pipelines/
https://azure.microsoft.com/en-us/blog/acceleating-devops-with-github-and-azure/
最近,我使用 Azure 的“Azure SignalR Service”和 Azure App Service 构建了一个实时聊天应用程序。它像魔术一样工作。我爱它!但是,我现在受限于将 AWS 用于我的平台,并希望获得同等替代服务,以便我可以构建实时服务,只利用 AWS 服务。
我可以利用 AWS 中的什么平等子站点来构建实时应用程序,类似于我使用 Azure SignalR 服务和 Azure 应用程序服务构建 Azure 应用程序的方式?
我的计划是同时使用 API Gateway + AWS Elastic Beanstock。我在这里有哪些选择?弹性豆料会奏效吗?不确定我是否需要在 Elastic beanstock 中实现某种类型的永远在线功能,以便停机期间不会停止 AWS 资源并中断 WebSocket 连接。
1 笔记值得一提。作为这个项目的一部分,我的硬性要求之一是创建一个 HTTP rest-full api。我的计划是将它放在 API Gateway 代理后面。
AWS 声明它在此处使用 API 网关提供实时服务
https://aws.amazon.com/blogs/compute/annoucing-websocket-apis-in-amazon-api-gateway/
但是,在 API Gateway 中,我相信我需要创建“HTTP API”而不是“WebSocket API”。如果我有一个使用 ASP.NET Core web api 的后端 web api,我还可以选择 WebSocket API 吗?

如果我使用 AWS“WebSocket API”,如何在仍然允许实时的同时为我的后端 ASP.NET Core web api 创建 API 前端(代理)?
amazon-web-services signalr amazon-elastic-beanstalk aws-api-gateway
我正在使用
"@aspnet/signalr": "^1.1.4",
Run Code Online (Sandbox Code Playgroud)
在 Angular 8 项目中。
不幸的是,文档似乎已过时?
https://docs.microsoft.com/en-us/aspnet/core/signalr/javascript-client?view=aspnetcore-3.1
文档声称有一种方法
withAutomaticReconnect()
Run Code Online (Sandbox Code Playgroud)
用作
const connection = new signalR.HubConnectionBuilder()
.withUrl("/chatHub")
.withAutomaticReconnect()
.build();
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试输入它时,我得到
“HubConnectionBuilder”类型上不存在属性“WithAutomaticReconnect”
这是文档过时的问题吗?还是我误解了配置?
这是我尝试添加此方法之前的确切代码
private _hubConnection: HubConnection;
Run Code Online (Sandbox Code Playgroud)
...
this._hubConnection = new HubConnectionBuilder()
.withUrl(this.myAPIUrl + '/myHub', { accessTokenFactory: () => tokenFromCache })
.configureLogging(signalR.LogLevel.Error)
.build();
Run Code Online (Sandbox Code Playgroud) 在 jenkins 声明式管道中,如何根据自定义 groovy/powershell 方法设置环境变量的值?例如,如果我有一个如下的声明式管道,我可以使用共享库方法来设置这个值吗?本质上,我正在尝试使用具有部署阶段的多分支声明性管道 jenkins 作业,但我需要确保开发分支部署到 DEV,发布分支部署到 STG,但使用相同的管道。我的想法是创建一个基于自定义方法(可能在共享库中的 Groovy 中)设置的环境变量,该方法将简单地查看 env.BRANCH 的当前值,并且只需要一些逻辑来设置目标部署环境。这是我设想的一个例子
pipeline {
environment {
DEPLOY_ENV = mapBranchToDeployEnvironment(${BRANCH})
}
Run Code Online (Sandbox Code Playgroud)
然后在我的部署阶段,我会在两次 powershell 调用中使用这个值
bat "powershell .\\Deploy-Service -Environment ${DEPLOY_ENV}"
bat "powershell .\\Deploy-ServiceProxy -Environment ${DEPLOY_ENV}"
Run Code Online (Sandbox Code Playgroud)
否则,人们目前如何解决使用相同管道部署到不同环境同时在许多其他函数调用中使用变量的问题?Jenkins 推荐的将触发构建的分支名称映射到它应该部署到的环境(如果有的话)的方法是什么?根据我的理解,Declarative Pipeline 允许管道成为“多分支”,如果作业也部署,它需要映射到部署环境。当所有全局 jenkins 管道环境变量对于每个作业/分支执行的值都相同时,管道将如何使用多分支部署到多个环境?
在上面的场景中,管道变量“DEPLOY_ENV”源自作业设置的其他环境变量,通常在阶段级别可用,但在这里我们希望全局设置该值,以便我们可以跨阶段使用它
更新:我的问题是我没有意识到它有多简单,而是认为我必须将一个舞台或脚本对象传递给一个 groovy 共享库函数,而实际上它就像创建一个共享库一样简单,然后直接引用方法中的环境变量。简单。谢谢你。
groovy continuous-integration continuous-deployment jenkins jenkins-pipeline
我有一个返回以下结果的 web api
{
"customerContactID": 1,
"customerID": 1,
"firstName": "james",
"lastName": "smithman",
"primaryEmail": "james@gmail.comm",
"primaryPhone": "8788494677",
"isPrimaryContact": true
}
Run Code Online (Sandbox Code Playgroud)
我有一个 angular 5 应用程序,它定义了一个接口
interface CustomerContact {
CustomerContactID: number;
CustomerID: number;
FirstName: string;
LastName: string;
PrimaryEmail: string;
PrimaryPhone: string;
IsPrimaryContact: boolean;
}
Run Code Online (Sandbox Code Playgroud)
并使用返回结果
this.http.get<CustomerContact>(url).subscribe(result => {
console.log("CustomerContact obtained");
console.log(result); // prints lowercase properties
this.customerContact = result;
}, error => console.error(error));
Run Code Online (Sandbox Code Playgroud)
不幸的是,当我记录结果时,我可以看到属性都被小写了,所以我不能做这样的事情
this.currentCustomer = result.CustomerID;
Run Code Online (Sandbox Code Playgroud)
因为它导致未定义。但是,我需要能够将变量值设置为从 api 结果获得的值,特别是 result.CustomerID。打字稿不允许我做
this.currentCustomer = result.customerID;
Run Code Online (Sandbox Code Playgroud)
因为它导致
TS2551: Property 'customerID' does not exist on type 'CustomerContact'. …Run Code Online (Sandbox Code Playgroud) 我发现开箱即用 (v<=1.11) twilio flex 允许热传输到
我有兴趣扩展此功能,以便我可以将外部电话号码添加到列表/集合中,并从 UI 角度与外部方进行交互,类似于我与代理/队列交互的方式。换句话说,我希望允许热转移到
我希望温暖转移到外部电话号码可以有类似的体验,如下所示 https://www.twilio.com/docs/flex/warm-transfer-end-user-guide
我可以使用哪些自定义选项来添加此类功能?我该从哪里开始呢?
I would imagine that many other businesses that use flex have a strong use case to do warm transfers to external phone numbers while using the flex UI. Perhaps to people who are using other types of systems, and are located within an entirely different company. How might they be accomplishing this use case?
Is the 'warm transfer' experience exclusive to transfers that are …
我有一个使用 swagger 库的 asp.net 核心应用程序
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
Run Code Online (Sandbox Code Playgroud)
我希望允许使用 /swagger 网页的 api 开发人员能够使用“ClientCredentials”流获取令牌。我已尝试以下操作,但遇到选项预检问题
c.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
{
Type = SecuritySchemeType.OAuth2,
Flows = new OpenApiOAuthFlows
{
ClientCredentials = new OpenApiOAuthFlow
{
TokenUrl = new Uri(baseAuthURL + "/oauth2/v2.0/token"),
Scopes = new Dictionary<string, string>
{
{ "ABC/.default", "Access read operations" }
},
AuthorizationUrl = new Uri(baseAuthURL + "/oauth2/authorize")
}
}
});
Run Code Online (Sandbox Code Playgroud)
当我点击授权时
查看控制台后,这是我看到的
从源 'https://localhost:44312' 访问 'https://login.microsoftonline.com/ABCD/oauth2/v2.0/token' 已被 CORS 策略阻止:没有 'Access-Control-Allow -Origin' 标头存在于请求的资源上。如果不透明响应满足您的需求,请将请求的模式设置为“no-cors”以在禁用 CORS 的情况下获取资源。
我该如何解决这个问题?要解决此问题,究竟需要对“AddSecurityDefinition”进行哪些更改?这是我什至能够解决的问题吗?(假设身份提供者可以支持选项预检请求)
是创建反向代理的唯一解决方法吗?
如何扩展上面的代码以在请求中发送自定义 HTTP 请求标头?
我在网上搜索了几个小时,其中有人成功使用 ClientCredentials …
我有一个带有 csproj 的 MRE lambda 项目
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AWSProjectType>Lambda</AWSProjectType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
<PackageReference Include="Amazon.Lambda.Logging.AspNetCore" Version="3.0.1" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.6" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.6" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.6" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.6" />
</ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
我创建了一个简单的函数处理程序,它调用 _svc.DoSomethingThatLogsUsingLogger();
如下所示
using Amazon.Lambda.Core;
using AWSLambda3.Services;
using Microsoft.Extensions.DependencyInjection;
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
namespace AWSLambda3
{
public class Function
{
private …Run Code Online (Sandbox Code Playgroud) 偶尔,在visual studio 2015 IDE中工作时,我收到窗口提醒我可以使用应用程序洞察.但是,我没有在窗口上看到任何禁用按钮,并且想要禁用通知.如何确保我不再收到这些通知?
当使用带有死信和 Lambda 的 SQS 时,为什么在 lambda 因运行时异常而失败后消息仍保持“飞行中”状态 5 分钟?
我创建了 3 个资源
MyQueue(配置为将无法送达的消息发送到 MyQueueDLQ。默认可见性超时:30 秒)
我的队列DLQ
Lambda(重试尝试设置为 0,超时 30 秒)
出于某种原因,我期望(可能是因为缺乏理解)当我的 lambda 失败时,死信队列会在失败后不久收到消息。(而不是几分钟后)。
我究竟如何确保死信队列以尽可能最快的方式获取消息,以便响应死信队列消息的任何内容都不会不必要地等待几分钟?
注意:我故意在 lambda 中抛出一个运行时异常来测试它,以便我了解这一切是如何工作的。
我的目标是确保消息尽快进入死信队列。5 分钟是我能做的最好的吗?
更新 1:我已将 lambda 的超时设置为 5 秒,将队列的超时设置为 25 秒,现在消息到达 DLQ 需要大约 1 分 40 秒。这仍然不符合我的期望。消息不是应该在 25 秒内到达 DLQ 吗?
我正在运行 terraform .tf 脚本来创建 aws_vpc_endpoint
这是示例代码
resource "aws_vpc_endpoint" "NewVPCEndpoint" {..}
Run Code Online (Sandbox Code Playgroud)
但是,在调用 terraform apply 时,我收到错误
Error creating VPC Endpoint: UnauthorizedOperation: This operation does not support shared VPCs.
status code: 403
Run Code Online (Sandbox Code Playgroud)
我收到此错误的具体原因是什么?
我在不同的 VPC 中尝试了完全相同的 .tf 脚本,效果很好。这是VPC本身的设置吗?这究竟是什么设置?
对于 VPC 和子网,VPC/子网的先决属性/设置是什么?
resource "aws_vpc_endpoint" "NewVPCEndpoint"
Run Code Online (Sandbox Code Playgroud)
为了成功?
c# ×3
angular ×2
asp.net-core ×2
aws-lambda ×2
javascript ×2
signalr ×2
typescript ×2
.net-core ×1
amazon-sqs ×1
amazon-vpc ×1
azure ×1
azure-devops ×1
groovy ×1
ide ×1
jenkins ×1
oauth ×1
swagger ×1
terraform ×1
twilio ×1
twilio-flex ×1
unit-testing ×1