我已经为 REST API 设置了 Azure SignalR 服务。设置下共有三种模式:Default、Serverless、Classic。我找不到有关这些项目中的每一个设置的任何信息。到目前为止,我唯一得到的一件事是,如果我将 Azure SignalR 用于 Azure Functions 或 REST API,则最好使用Serverless option。
从文档:
仅当通过 Azure Functions 绑定或 REST API 使用 Azure SignalR 服务时,才将服务模式设置更改为无服务器。否则将其保留为经典或默认。
ASP.NET SignalR 应用程序不支持无服务器模式。始终对 Azure SignalR 服务实例使用默认或经典。
你能帮我找出每个选项的设置吗?
azure signalr asp.net-core-signalr azure-signalr azure-rest-api
遇到有关正常关闭 asp.net 核心应用程序的非常过时的信息,有人可以填写更新的信息。
用例:我想在应用程序退出时向 consul 注销。
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((host, config) =>
{
})
.UseStartup<Service>();
Run Code Online (Sandbox Code Playgroud) 我在弄清楚如何使我的模态可拖动时遇到了一些困难。我有可重用的模态及其自己的服务,该服务被调用以创建一个内部组件。
确认.modal.service.ts
import { Injectable } from "@angular/core";
import { NgbModal } from "@ng-bootstrap/ng-bootstrap";
import { Observable, from, EMPTY, throwError } from "rxjs";
import { catchError, tap } from "rxjs/operators";
import { ConfirmModalComponent } from "./confirm-modal.component";
export interface ConfirmOptions {
title: string;
subtitle?: string;
errorOnClose?: boolean;
}
@Injectable({ providedIn: "root" })
export class ConfirmModalService {
constructor(private modalService: NgbModal) {}
confirm(options: ConfirmOptions): Observable<boolean> {
const modalRef = this.modalService.open(ConfirmModalComponent, {
centered: true
});
modalRef.componentInstance.title = options.title || "Are you sure?";
modalRef.componentInstance.subtitle = …Run Code Online (Sandbox Code Playgroud) 在尝试了所有其他解决方案之后,我仍然遇到我的问题:尝试导航到其他组件,URL 已更改,但我留在同一页面上,目标组件未加载。
解释:
当用户到达 App 时,根据会话存储,他会转到HOME 组件或LOGIN 组件。
如果他登陆主页组件,一切正常,他可以在应用程序中导航到任何地方。
否则,如果他登陆 LOGIN,然后登录自己,然后重定向到 HOME 组件,那么就不再有导航工作,只有 url 发生变化。
我使用了延迟加载和 authGuard。
控制台上没有错误。
上述两种情况之间的路由器跟踪日志是相同的(我的意思是在第二种情况下,NavigationEnd 组件是正确的目标组件,但它从未加载)
这是我的app-routing.module.ts:
const routes: Routes = [
{
path: '',
redirectTo: 'login',
pathMatch: 'full',
},
{
path: 'home',
loadChildren: './pages/home/home.module#HomeModule',
canActivate: [AuthGuard]
},
{
path: 'description',
loadChildren: './pages/description/description.module#DescriptionModule',
canActivate: [AuthGuard]
},
{
path: 'nsp',
loadChildren: './pages/nsp/nsp.module#NspModule',
canActivate: [AuthGuard]
},
{
path: 'login',
loadChildren: './pages/login/login.module#LoginModule'
},
{
path: 'mappings',
loadChildren: …Run Code Online (Sandbox Code Playgroud) 这是一个功能,如果数据不存在,则通过参考现有数据添加新数据,如果存在则更新数据。它运行良好,但一个小时后出现gRpc错误。详情如下:
Error: No connection established
at Http2CallStream.<anonymous> (D:\zyleTcpServer\node_modules\@grpc\grpc-js\build\src\call.js:68:41)
at Http2CallStream.emit (events.js:215:7)
at D:\zyleTcpServer\node_modules\@grpc\grpc-js\build\src\call-stream.js:75:22
at processTicksAndRejections (internal/process/task_queues.js:75:11)
---------------------------------------------
at BunWrapper.Readable.on (D:\zyleTcpServer\node_modules\bun\node_modules\readable-stream\lib\_stream_readable.js:729:33)
at D:\zyleTcpServer\node_modules\@google-cloud\firestore\build\src\index.js:920:26
at new Promise (<anonymous>)
at Firestore._initializeStream (D:\zyleTcpServer\node_modules\@google-cloud\firestore\build\src\index.js:881:16)
at D:\zyleTcpServer\node_modules\@google-cloud\firestore\build\src\index.js:1017:28 {
code: 14,
details: 'No connection established',
metadata: Metadata { internalRepr: Map {}, options: {} }
}
这是我的代码
<code>
const docName = `${vin}-${dtc}`; //make doc
const ebsRef = db.collection('events').doc(docName);
await db.runTransaction((t) => t.get(ebsRef)
.then(async (doc) => {
if (!doc.exists) {
return t.set({
startDatetime: firebase.firestore.FieldValue.serverTimestamp(),
endDatetime: firebase.firestore.FieldValue.serverTimestamp(),
description: …Run Code Online (Sandbox Code Playgroud) 预测每个所选样本的类别分配概率Train_features:
probs = classifier.predict_proba(Train_features)`
Run Code Online (Sandbox Code Playgroud)
选择必须确定 AUC 的类别。
preds = probs[:,1]
Run Code Online (Sandbox Code Playgroud)
计算假阳性率、真阳性率以及可以清楚地区分 TP 和 TN 的可能阈值。
fpr, tpr, threshold = metrics.roc_curve(Train_labels, preds)
roc_auc = metrics.auc(fpr, tpr)
print(max(threshold))
Run Code Online (Sandbox Code Playgroud)
输出:1.97834
I have configured an xUnit project to test an Identity Server implementation. I have created a TestStartup class which inherits Startup and overrides my Identity Server implementation for testing purposes. The problem is when I call my TestStartup using my custom WebApplicationFactory, my endpoints are not mapped. If I call Startup from my custom WebApplicationFactory, my endpoints are mapped.
Startup.cs
protected readonly IConfiguration _configuration;
protected readonly IWebHostEnvironment _webHostEnvironment;
public Startup(IConfiguration configuration, IWebHostEnvironment environment)
{
_configuration = configuration;
_webHostEnvironment …Run Code Online (Sandbox Code Playgroud) 我需要如何设置HttpInterceptor?oidcSecurityService没有定义。
将HttpClient让你写拦截器。一个常见的用例是拦截任何传出的 HTTP 请求并添加授权标头。请记住,OidcSecurityService通过构造函数注入拦截器会导致循环依赖。为避免这种情况,请改用注射器。
@Injectable()
export class AuthInterceptor implements HttpInterceptor {
private oidcSecurityService: OidcSecurityService;
constructor(private injector: Injector) {}
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
let requestToForward = req;
if (this.oidcSecurityService === undefined) {
this.oidcSecurityService = this.injector.get(OidcSecurityService);
}
if (this.oidcSecurityService !== undefined) {
let token = this.oidcSecurityService.getToken();
if (token !== '') {
let tokenValue = 'Bearer ' + token;
requestToForward = req.clone({ setHeaders: { Authorization: tokenValue } });
}
} else {
console.debug('OidcSecurityService …Run Code Online (Sandbox Code Playgroud) angular ×3
typescript ×3
asp.net-core ×2
javascript ×2
auc ×1
auth-guard ×1
azure ×1
draggable ×1
firebase ×1
html ×1
roc ×1
signalr ×1
xunit.net ×1