小编aph*_*ph5的帖子

@ngrx/store - 商店不会以异步/离开的方式返回数据

从商店获取价值时遇到问题。操作挂起。我尝试通过以下方式获取数据:

async onInit(params: Params) { 
  // it hangs on the line bellow
  var userToken = await this.store.select(fromRoot.getUserToken).toPromise();  
  console.log(userToken);
}
Run Code Online (Sandbox Code Playgroud)

然后我执行以下异步函数:

ngOnInit(): void {
this.route.params.subscribe(params => {
  this.onInit(params).then(() => console.log('promise executed'));
});
Run Code Online (Sandbox Code Playgroud)

永远不会返回用户令牌。

如果我订阅了商店,那么它工作正常。

this.store.select(fromRoot.getUserToken).subscribe(ut => {
  console.log(ut);
});
Run Code Online (Sandbox Code Playgroud)

ngrx angular

6
推荐指数
1
解决办法
1275
查看次数

使用docker-compose时如何读取外部机密

我不知道如何将外部机密传递给docker-compose产生的服务。我执行以下操作:

我创造新的秘密

printf "some secret value goes here" | docker secret create wallet_password -
Run Code Online (Sandbox Code Playgroud)

我的docker-compose.yml:

version: "3.4"
services:
  test:
    image: alpine
    command: 'cat /run/secrets/wallet_password'
    secrets: 
    - wallet_password

secrets:
  wallet_password:
    external: true
Run Code Online (Sandbox Code Playgroud)

然后我运行:

docker-compose -f services/debug/docker-compose.yml up -d --build
Run Code Online (Sandbox Code Playgroud)

docker-compose -f services/debug/docker-compose.yml up
Run Code Online (Sandbox Code Playgroud)

我得到以下回应:

WARNING: Service "test" uses secret "wallet_password" which is external. External secrets are not available to containers created by docker-compose.
WARNING: The Docker Engine you're using is running in swarm mode.

Compose does not use swarm mode …
Run Code Online (Sandbox Code Playgroud)

docker docker-compose

6
推荐指数
2
解决办法
2189
查看次数

如何在cloudflare下配置nginx以支持signalr3?

我正在努力使用signalr3和nginx反向代理配置,我的nginx cfg看起来像这样:

server {
listen       80;
server_name  my.customdomain.com;

location / {
  root /pages/my.customdomain.com;
  index index.html index.htm;
  try_files $uri $uri/ /index.html =404;
}

## send request back to kestrel ##
location /proxy/ {
 proxy_pass  http://xxxxxxxxxx.westeurope.cloudapp.azure.com/;

 proxy_set_header        Host            $host;
 proxy_set_header        X-Real-IP       $remote_addr;
 proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
 }
}
Run Code Online (Sandbox Code Playgroud)

我在这里想念什么?

当我浏览我的页面时,我收到了OK

GET /proxy/notifications/negotiate 
Run Code Online (Sandbox Code Playgroud)

GET /proxy/notifications?id=uFQtMDg1dXib6LGvUssQhQ
Run Code Online (Sandbox Code Playgroud)

但是404用于POST

POST proxy/notifications?id=uFQtMDg1dXib6LGvUssQhQ
Run Code Online (Sandbox Code Playgroud)

请停下来!

PS.我的中心很简单......

[AllowAnonymous]
public class NotificationHub : Hub
{

}
Run Code Online (Sandbox Code Playgroud)

asp.net nginx signalr nginx-reverse-proxy

6
推荐指数
1
解决办法
141
查看次数

添加 Microsoft.AspNetCore 包后无法解析 System.Runtime.InteropServices.RuntimeInformation

我遇到了以下问题。

我创建了一个针对 .net framework 4.6.2 的新 lib 项目,并通过 NuGet 引用了 System.Runtime.InteropServices.RuntimeInformation 包。(对象浏览器显示该 dll 的版本为 4.0.1.0,(在 nuget 中我指向安装版本 4.3))

我重新加载项目,以检查引用是否有问题。

现在我安装了 Microsoft.AspNetCore,我重新加载了项目,对 System.Runtime.InteropServices.RuntimeInformation 和 System.Net.Htpp 的引用消失了。

在此处输入图片说明

附:安装 .netstandard 包没有帮助。

有没有人有类似的问题?

.net c# .net-core

3
推荐指数
2
解决办法
8135
查看次数

F#使用其他参数生成一个Actor

我在想如何在F#中生成一个带有一些额外参数的actor?

我有以下actor函数定义

let triggerActor (mailbox: Actor<TriggerCommand>) (name: string, expr : string, jobCallback : JobCallback) =

(...... cutted code, not needed here  )
Run Code Online (Sandbox Code Playgroud)

我试图包装该函数以生成一个演员

spawn system name (actorOf2 triggerActor    )
Run Code Online (Sandbox Code Playgroud)

但在这里我遇到了麻烦...我怎么能通过这些额外的参数?我知道我可以创建一个自定义C#风格的actor,但是现在我想尝试用F#:)

f# akka.net

1
推荐指数
1
解决办法
231
查看次数

F#型推理问题

我在编写测试时遇到了以下问题.请在下面找一张照片.

在此输入图像描述

如果我在单元测试项目中创建validateGameExistance函数,那么它工作正常.

怎么可以解决?

f#

0
推荐指数
1
解决办法
75
查看次数