有没有人知道在Delphi中实现Google Protocol Buffers实现的项目?
tsconfig.json需要什么才能在Chrome中运行?所以我只需运行tsc然后可以在浏览器中查看该文件,并在控制台中显示相应的结果?
index.html包含:
<!DOCTYPE html>
<html>
<head><title>TypeScript app</title></head>
<body>
<script src="dist/app.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
index.ts包含
import { alpha } from "alpha";
import { beta } from "beta";
console.log(alpha + " " + beta);
Run Code Online (Sandbox Code Playgroud)
alpha包含
export const alpha = 'alpha';
Run Code Online (Sandbox Code Playgroud)
beta包含
export const beta = 'beta';
Run Code Online (Sandbox Code Playgroud)
入口点是index.ts,我希望它们都捆绑在一个名为app.js的文件中.
我正在实现IdentityServer4,我正在制作3个不同的proyects:
所有项目都是使用ASP.NET Core创建的,但JS Client使用静态文件.
我需要JS Client只使用身份令牌(不是访问令牌)与API连接,因为我只需要访问API,我不需要管理用户身份验证.
我正在阅读快速入门帖子https://identityserver4.readthedocs.io/en/dev/quickstarts/1_client_credentials.html
在我阅读时,我认为我需要使用Implicit Grand Type,我不需要OpenID Connect,只需要OAuth2.
另外我读了这篇文章 https://identityserver4.readthedocs.io/en/dev/quickstarts/7_javascript_client.html 但他们使用访问令牌,我不需要它,连接到我正在使用的API oidc-client-js库https ://github.com/IdentityModel/oidc-client-js和我搜索使用Implicit Grand Type的方式,但我使用的方法将我重定向到http:// localhost:5000/connect/authorize页面(I认为这是我需要使用OpenID Connect的时候)
实现这一目标的最佳方法是什么?我错了什么?如何使用api进行认证并调用http:// localhost:5001/values
IdentityServer项目
Config.cs
public static IEnumerable<Client> GetClients()
{
return new List<Client>
{
new Client
{
ClientId = "client",
ClientName = "JavaScript Client",
// no interactive user, use the clientid/secret for authentication
AllowedGrantTypes = GrantTypes.Implicit,
AllowAccessTokensViaBrowser = true,
RedirectUris = new List<string> …Run Code Online (Sandbox Code Playgroud) 给出以下代码:
void MergeDbContext(DbContext aSourceDbContext, DbContext aDestinationDbContext)
{
var sourceEntities = aSourceDbContext.ChangeTracker.Entries().ToList();
foreach (DbEntityEntry entry in sourceEntities)
{
object entity = entry.Entity;
entry.State = EntityState.Detached;
// check if entity is all ready in aDestinationDbContext if not attach
bool isAttached = false;// TODO I don't know how to check if it is all ready attched.
if (!isAttached)
{
aDestinationDbContext.Set(entity.GetType()).Attach(entity);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我如何一般性地确定实体是否存在于上下文中.
更改 URLPrefix 后,出现以下错误:
SPA 默认页面中间件无法返回默认页面“/index.html”,因为未找到它,并且没有其他中间件处理该请求。
因此需要一些东西来告诉 dotnet core 关于前缀,但我似乎无法找到正确的设置组合。
非常感谢帮助。
代码如下:
HostBuilder 设置为:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseHttpSys(options =>
{
options.AllowSynchronousIO = false;
options.Authentication.Schemes = AuthenticationSchemes.None;
options.Authentication.AllowAnonymous = true;
options.MaxConnections = null;
options.MaxRequestBodySize = 30000000;
options.UrlPrefixes.Add("http://localhost:5005/Product/Site");
});
webBuilder.UseStartup<Startup>();
});
Run Code Online (Sandbox Code Playgroud)
配置服务:
public override void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "ClientApp/build";
});
services.AddMvc();
services.AddResponseCompression(opts =>
{
opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(
new[] { "application/octet-stream" });
});
}
Run Code Online (Sandbox Code Playgroud)
然后配置是:
app.UseSpaStaticFiles();
app.UseRouting();
app.UseEndpoints
(
endpoints => …Run Code Online (Sandbox Code Playgroud) 我有一个actions.ts声明了一堆操作类型的文件。
动作.ts
export interface Action1 extends Action {
type: types.Action1Type
}
export interface Action2 extends Action {
type: types.Action2Type
}
export interface Action3 extends Action {
type: types.Action3Type
}
Run Code Online (Sandbox Code Playgroud)
我使用以下命令将这些操作导入到 index.ts 中:
import * as actions from './actions';
Run Code Online (Sandbox Code Playgroud)
actionsindex.ts 文件中变量的类型是什么?我希望能够在 actions.ts 文件本身中创建此构造并将其导出。类似于以下内容:
动作.ts
interface Action1 extends Action {
type: types.Action1Type
}
interface Action2 extends Action {
type: types.Action2Type
}
interface Action3 extends Action {
type: types.Action3Type
}
export const Actions = {
Action1,
Action2,
Action3,
}
Run Code Online (Sandbox Code Playgroud)
但这给了我一个错误: …
使用 docker ACI 上下文时,以下 docker-compose 文件失败。mongodb容器不断重启。
version: "3.9"
services:
mongodb:
image: mongo:5.0.6
env_file: mongo.env
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=changeit
ports:
- 27017
volumes:
- dbdata:/data/db
volumes:
dbdata:
driver: azure_file
driver_opts:
share_name: mongodb-data
storage_account_name: kpncoqyuxumoetuftz
Run Code Online (Sandbox Code Playgroud)
如果我不使用 azure_file 存储,它将运行正常(但当然数据不会持久)
在我的 PowerShell 快捷方式上,我有以下内容:
C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -psc "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -noe -c ". \"C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1\""
Run Code Online (Sandbox Code Playgroud)
然而,我更愿意添加管理单元的注册并将 PowerCLI 环境的 init 运行到我的配置文件中。
所以在我的个人资料中,我添加了以下内容:
Add-PSSnapin VMware.VimAutomation.Core
& "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1"
Run Code Online (Sandbox Code Playgroud)
但是,使用此方法无法再使用 Get-VICommand。为什么?
我有一个MVC5 Azure网站,昨晚工作正常.现在,当尝试通过chrome登录时,它似乎陷入无限重定向循环.它可以从Edge和FireFox中正常工作.它使用Azure AD进行身份验证.重定向是从主站点来回登录到login.microsoftonline.com.
所以我正在尝试构建一个 Wix 安装程序。我收到以下错误。
Error 1 The system cannot find the file 'C:\Plastic\W2\AktionTLW2\AktionTLW2\bin\Debug\Templates\Federal.xml)'.
Run Code Online (Sandbox Code Playgroud)
相关代码是
<File Source="$(var.AktionTLW2.TargetDir)Templates\Federal.xml)" />
Run Code Online (Sandbox Code Playgroud)
当我将其更改为显式路径时,它不会给我一个错误:
<File Source="C:\Plastic\W2\AktionTLW2\AktionTLW2\bin\Debug\Templates\Federal.xml"/>
Run Code Online (Sandbox Code Playgroud)
请注意,显式路径和错误消息中的路径是相同的路径。那么为什么第一个不起作用呢?
运行以下命令:
Get-ADUser <username> -properties MemberOf | select MemberOf | Format-List *
Run Code Online (Sandbox Code Playgroud)
结果像
MemberOf : {CN=XXX,OU=xxx,OU=xxx,DC=xxx,DC=com, CN=XXX,OU=xxx,OU=xxx,DC=xxx,DC=com,CN=XXX,OU=xxx,OU=xxx,DC=xxx,DC=com,...}
Run Code Online (Sandbox Code Playgroud)
我不想看到“...”我实际上想看到所有项目。
azure ×2
javascript ×2
powershell ×2
typescript ×2
.net-core ×1
c# ×1
dbcontext ×1
delphi ×1
httpsys ×1
interface ×1
mongodb ×1
oauth-2.0 ×1
powercli ×1
tsconfig ×1
wix ×1