小编Ide*_*ity的帖子

如何完全禁用Sitecore Analytics

我们的生产服务器遇到了cpu问题.在使用jetbrains cpu profiler进行分析后,我们注意到程序集中的某些函数Sitecore.Analytics已被执行.

这有点奇怪,因为我们在de config文件中禁用了所有与分析相关的配置.

在查看之后/sitecore/admin/showconfig.aspx我们注意到Sitecore.Analytics在这个配置中仍然有很多相关的配置,而这些配置在我们的配置文件中被停用.

例如

在文件中/App_Config/Include/EventHandlers.config,配置如下所示:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
 <sitecore>
   <events timingLevel="custom">
   </events>
 </sitecore>
</configuration>
Run Code Online (Sandbox Code Playgroud)

在查看showconfig.aspx它时看起来像这样:

<events timingLevel="custom">
<event name="forms:save"/>
<event name="item:saved">
            <handler type="Sitecore.Analytics.Data.Items.ItemEventHandler, Sitecore.Analytics" method="OnItemSaved"/>
            <handler type="Sitecore.Analytics.Automation.Data.Items.ItemEventHandler, Sitecore.Automation.MarketingAutomation" method="OnAutomationStateChanged"/>
        </event>
        <event name="item:deleted">
            <handler type="Sitecore.Analytics.Automation.Data.Items.ItemEventHandler, Sitecore.Automation.MarketingAutomation" method="OnAutomationStateChanged"/>
        </event>
        <event name="media:request">
            <handler type="Sitecore.Analytics.Media.MediaRequestEventHandler, Sitecore.Analytics" method="OnMediaRequest"/>
        </event>
</events>
Run Code Online (Sandbox Code Playgroud)

有谁知道为什么这些仍在返回showconfig.aspx?有没有办法完全删除/禁用sitecore分析模块?

sitecore sitecore6 sitecore-dms

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

使用密钥保管库生成客户端证书

对于我们的点到站点 VPN,我们要创建一个根证书。因此,我们可以为需要登录我们 VPN 的所有合作伙伴创建任意数量的客户端证书。(Azure 虚拟网络)

手动执行此操作非常完美。我们生成一个作为根 ca 的证书(自签名)。我们可以像这样在 powershell 中做到这一点:

$cert = New-SelfSignedCertificate -Type Custom -KeySpec Signature -Subject "CN=Kratos Point To Site VPN Root Certificate Win10" -KeyExportPolicy Exportable -HashAlgorithm sha256 -KeyLength 2048 -CertStoreLocation "Cert:\CurrentUser\My" -KeyUsageProperty Sign -KeyUsage CertSign

$clientCert = New-SelfSignedCertificate -Type Custom -KeySpec Signature -Subject "CN=Digicreate Point To Site VPN Client Certificate Win10" -KeyExportPolicy Exportable -HashAlgorithm sha256 -KeyLength 2048 -CertStoreLocation "Cert:\CurrentUser\My" -Signer $cert -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.2")
Run Code Online (Sandbox Code Playgroud)

但是,我们更喜欢使用密钥保管库进行证书管理。这个想法是使用以下命令直接在密钥保管库中创建证书:Add-AzureKeyVaultCertificate(私钥不可导出)

创建根证书工作正常。但是我无法找到如何使用密钥保管库中的“签名”操作来签署新证书。

你有关于如何做到这一点的样本吗?

certificate azure azure-keyvault

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

更新ClaimsPrincipal中的声明

我正在使用Adal和Azure Active Directory,我需要通过自定义OwinMiddleware添加额外的声明.当我向此主体添加声明时,我可以在当前请求中访问它们.但是在页面刷新之后,声明就消失了.

我认为Owin处理了声明的序列化并将其放入cookie本身,但事实并非如此.

我将声明添加如下:

 var claimsIdentity = (ClaimsIdentity) ClaimsPrincipal.Current.Identity;
        if (!claimsIdentity.IsAuthenticated) return;

        var identity = new ClaimsIdentity(claimsIdentity);

        var currentTenantClaim = GetTenantClaim();

        if (currentTenantClaim != null)
            claimsIdentity.RemoveClaim(currentTenantClaim);

        claimsIdentity.AddClaim(new Claim(ClaimTypes.CurrentTenantId, id));

        context.Authentication.AuthenticationResponseGrant = new AuthenticationResponseGrant
            (new ClaimsPrincipal(identity), new AuthenticationProperties {IsPersistent = true});
Run Code Online (Sandbox Code Playgroud)

关于如何将新声明保留在cookie中的任何想法?

c# azure-active-directory adal

5
推荐指数
2
解决办法
8545
查看次数

如何在ARM模板中输出秘密uri?

我无法从我的 ARM 模板中的秘密资源中输出秘密 URI。关于如何做到这一点的任何想法?

azure-resource-manager azure-keyvault

5
推荐指数
2
解决办法
3248
查看次数

Azure Web 作业中的信号量

我想知道信号量(锁)是否可以在 Azure 函数中工作。我不希望两个单独的网络作业同时运行。网络工作采用相同的应用程序服务计划。

这是我可以用信号量保证的吗?(因为这可以实现跨进程锁定?)

azure azure-webjobs azure-functions

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

不支持Kendo ui odata请求回调

我正在使用Kendo UI处理odata网格.问题是ajax请求保持包含回调参数.这导致此错误:不支持回调参数.当我在没有回调的情况下手动执行请求时,我的odata服务工作正常.有人知道如何解决这个问题?

$("#grid").kendoGrid({
        dataSource: new kendo.data.DataSource({
            type:"odata",
            serverPaging: true,
            serverFiltering: true,
            serverSorting: true,

            transport: {
                contentType: "application/json; charset=utf-8",
                type: "GET",
                read: "/odata/FestivalSignUps?$inlinecount=allpages&$expand=PrefferedTasks/Task,AvailableDays,ApplicationUser",
                dataType: "json",
                parameterMap: function (options, type) {
                    var paramMap = kendo.data.transports.odata.parameterMap(options);
                    delete paramMap.$format; // <-- remove format parameter.

                    return paramMap;
                }
            },


            pageSize: 10,
            schema: {
                data: function (data) {
                    return data["value"];
                },
                total: function (data) {
                    return data["odata.count"];
                },

            }
        }),
        filterable:true,
        sortable: true,
        pageable: {
            refresh: true,
            pageSizes: true,
            buttonCount: 5
        },
        columns: [
            { field: …
Run Code Online (Sandbox Code Playgroud)

odata kendo-ui

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

Owin 中间件中的 MVC 错误处理

当控制器中抛出某些异常时,我想捕获这些异常并执行一些额外的逻辑。

我能够通过添加到全局过滤器列表中的自定义 IExceptionFilter 来实现此目的。

但是,我更喜欢在自定义 Owin 中间件中处理这些异常。我的中间件如下所示:

      try
        {

            await Next.Invoke(context);
        }
        catch (AdalSilentTokenAcquisitionException e)
        {
           //custom logic
        }
Run Code Online (Sandbox Code Playgroud)

这段代码不起作用,看起来异常已经在 MVC 中捕获并处理了。有没有办法跳过MVC的异常处理并让中间件捕获异常?

c# asp.net-mvc owin owin-middleware

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

ARM 模板中的 KeyVault 参考问题

我正在尝试创建一个主密钥保管库,其中将包含所有证书以作为某个用户进行身份验证。

我有 2 个服务主体 => 一个用于我的应用程序,一个用于部署。这个想法是部署服务主体可以访问 Key Vault 并将位于那里的证书添加到 Web 应用程序的存储中。

我已经创建了服务主体,并已授予他对密钥保管库的所有权限。我还为该密钥保管库启用了 ARM 模板中的访问机密。

使用 powershell,我能够以部署 SP 身份登录并检索机密(证书)。

但是,这在部署引用密钥保管库的 ARM 模板时不起作用。我收到以下错误:

New-AzureRmResourceGroupDeployment : 11:16:44 - Resource Microsoft.Web/certificates 'test-certificate' failed with message '{
  "Code": "BadRequest",
  "Message": "The service does not have access to '/subscriptions/98f06e7e-1016-4088-843f-62690f3bb306/resourcegroups/rg-temp/providers/microsoft.keyvault/vaults/master-key-vault' Key 
Vault. Please make sure that you have granted necessary permissions to the service to perform the request operation.",
  "Target": null,
  "Details": [
    {
      "Message": "The service does not have access to '/subscriptions/xxxx/resourcegroups/xxx/providers/microsoft.keyvault/vaults/master-key-vault' Key 
Vault. Please make …
Run Code Online (Sandbox Code Playgroud)

azure azure-powershell azure-keyvault azure-rm-template azure-template

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

Sitecore HttpModules第二次初始化

我们正在经历突发瞬间的CPU峰值.检查我们的Sitecore日志后,我注意到有很多日志条目"11:49:26正在初始化INFO HttpModule".据我所知,这应该仅在应用程序启动时初始化.这仍然在应用程序启动后出现.我对吗?如果是这样,这些模块可以在哪里第二次初始化?

performance sitecore httpmodule cpu-usage ihttpmodule

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

文档DbChangeFeed中的MaxItemCount

我正在测试DocumentDb中的新更改源.我通过轮询API将它连接到Logic应用程序.

因为我每个请求只需要1个项目,所以我将MaxItemCount设置为1.这非常有效......直到获得36个结果.下一个请求给出了70个结果(并且最大项目数设置为1)并且跳过了+ - 150个文档.

这是DocumentDB中的错误还是我做错了什么?

看到代码,前36次,我只得到1个结果,从那时起我得到了上述问题:

 var changeFeedOptions = new ChangeFeedOptions
        {
            MaxItemCount = 1,
            RequestContinuation = continuationToken,
            PartitionKeyRangeId = partitionKey, // singe partioned collection
            StartFromBeginning = fromBeginning
        };

        var feed = ((DocumentClient) _documentClient).CreateDocumentChangeFeedQuery(
            collectionUri,
            changeFeedOptions);

        var result = await feed.ExecuteNextAsync();

        var document = result.FirstOrDefault();

        return new ChangeFeedResponse
        {
            ContinuationToken = result.ResponseContinuation, // this token will be used the next time
            Document = document
        };
Run Code Online (Sandbox Code Playgroud)

c# azure azure-cosmosdb

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

100% 代码覆盖率,抱怨 MoveNext()

我正在努力实现 100% 的代码覆盖率。然而,不知何故,代码覆盖率抱怨某些未覆盖的 MoveNext() 方法,但是,没有迭代 IEnumerable 的代码路径...

代码覆盖率结果

代码片段

关于如何覆盖 MoveNext 方法有什么想法吗?MoveNext() 位于哪里?

c# unit-testing code-coverage

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