小编ale*_*eha的帖子

Asp Net Core Web推送通知

主要目标是增加站点发送Web通知的能力,以弹出系统通知,以使用Html5 Push API和服务工作人员提醒用户.不使用SignalR,它只能在打开网站时运行客户端脚本.也应该是,如果网站被关闭,如提及发布通知的能力在这里 -这是可能的.

是关于Push API的好文章并提供了很好的示例 但是它使用NodeJS作为服务器和web-push组件来向通知服务发送请求.

找不到任何.NET示例.我想到了两个解决方法.

首先,是基于关于服务器的Push API文章说明从头开始编写所有内容:

当您发送没有数据的推送消息时,您只需使用HTTP POST请求将其发送到端点URL.但是,当推送消息包含数据时,您需要对其进行加密,这是一个非常复杂的过程.

其次,是使用AspNetCore.NodeServices(关于它的文章)来执行node.js脚本文件

还有更多解决方案吗?也许存在现成的解决方案?

经过学科研究

3例:

  1. HTTP +旧浏览器+ IE所有版本 - 使用信号R +使用html + js渲染通知
  2. HTTP +现代浏览器(Chrome,Firefox,Safary,Opera?,Edge),支持Notification API. - 使用SignalR并使用js触发本机浏览器通知new Notification('Message')
  3. HTTPS + Chrome(移动版),支持Push API,可以使用服务工作者触发已关闭网站的本机通知.移动版Chrome只能使用service-worker创建通知.

它变得复杂了.怎么了?

可能的解决方案:

对于1和2个案例找到了存储库.认为这是一个很好的前端解决方案,具有良好的后备支持.对于3个案例仍然不知道该怎么做.

当前解决方案 补充:2017-11-22

  • 没有脱机客户端通知支持
  • 没有移动支持
  • 对于Chrome v62 +将所有项目移至https - 链接
  • 使用SignalR(0.2.0)将推送发送到在线客户端
  • 使用pnotify v3 +显示本机desctop或html通知.
  • 正在等待pnotify v4.0.0(作者承诺提供Chrome移动支持.问题)
  • 等待带有SignalR 1.0的.NET Core 2.1将整个项目重写到它.

c# web-push push-api asp.net-core asp.net-core-webapi

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

JavaScript 通知 API requireInteraction

试图了解这个功能是如何工作的。

MDN文章说:

通知接口的 requireInteraction 只读属性返回一个布尔值,指示通知应保持活动状态,直到用户单击或关闭它,而不是自动关闭。

我的测试页面有这个js脚本:

new Notification("Header text", {
    icon: '/images/someImage.png',
    body: 'Notification body text!',
    requireInteraction : true
});
Run Code Online (Sandbox Code Playgroud)

在不同浏览器中测试。Windows 10。

  • Chrome (56.0.2924.87) - 支持,无自动关闭
  • Firefox (53.0a2 dev) - 忽略此标志,20 秒后自动关闭
  • Edge (38.14393.0.0) - 忽略此标志,大约 6 秒后自动关闭,使用 Windows 通知,信息保留在通知面板中
  • Opera (43.0.2442.1144) - 忽略此标志,大约 6 秒后自动关闭,使用 Windows 通知,信息不会保留在通知面板中
  • Yandex浏览器(17.3.0.1849)支持,无自动关闭(认为它内部使用chrome)

在 Android 设备上检查了它 - 通知保留在通知面板中,而您不手动关闭它们。

关于 Firefox 的一些评论。是关于此的错误信息。它的状态:

已解决 已在 Firefox 52 中修复

检查了 52 和 53 版本。结果如上。这是一个错误吗?

主要问题:我这样做(创建通知)是错误的吗?或者说使用Notification API不可能实现跨浏览器不自动关闭通知?

javascript notifications cross-browser

5
推荐指数
0
解决办法
1488
查看次数

ASP.NET Core SignalR websocket 连接限制

我使用 Microsoft.AspNetCore.SignalR.Client 对在 Windows Server 2016 标准上托管的 SignalR (ASP.NET Core) 应用程序进行负载测试。安装了 Dotnet 核心托管 2.1.1

我无法创建超过 3000 (2950-3050) 个连接。

已经尝试过此处描述的建议:

添加了限制UseKestrel(如果我将值设置为 100 或 1000,这似乎有效):

var host = new WebHostBuilder()
    .UseKestrel(options =>
    {
        options.Limits.MaxConcurrentConnections = 50000;
        options.Limits.MaxConcurrentUpgradedConnections = 50000;
    })
Run Code Online (Sandbox Code Playgroud)

通过添加以下内容更改了所有 aspnet.config 文件:

<system.web>
    <applicationPool maxConcurrentRequestsPerCPU="50000" />
</system.web>
Run Code Online (Sandbox Code Playgroud)

执行了这个命令:

cd %windir%\System32\inetsrv\ appcmd.exe 设置配置 /section:system.webserver/serverRuntime /appConcurrentRequestLimit:50000

添加了Web Service\Current Connections - Maximum Connections的性能计数器。并且最大连接数增加到 3300 并停止。

服务器日志没有异常。但我感觉系统有一些限制。

服务器 IIS 日志仅包含以下内容:

获取 …

signalr signalr.client asp.net-core asp.net-core-signalr

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

HttpResponseMessage ReasonPhrase最大长度?

我有以下代码:

public void Put(int id, DistributionRuleModelListItem model)
{
    CommonResultModel pre = new BLL.DistributionRules().Save(id, model, true);
    if(!pre.success){
        DAL.DBManager.DestroyContext();
        var resp = new HttpResponseMessage(HttpStatusCode.InternalServerError)
        {
            Content = new StringContent(string.Format("Internal server error for distruleId: {0}", id)),
            ReasonPhrase = pre.message.Replace(Environment.NewLine, " ")//.Substring(0,400)
        };
        throw new HttpResponseException(resp);
    }
}
Run Code Online (Sandbox Code Playgroud)

有一种逻辑可以将pre.message的值设置为an exception.ToString(),如果时间太长,则会收到以下应用程序异常:

指定的参数超出有效值范围。参数名称:值

但是,如果我取消注释,.Substring(0,400)一切都很好,并且在客户端,我会收到正确的响应,并且可以将其显示给用户。

ReasonPhrase的最大长度是多少?我找不到任何指定此值的文档。

asp.net-mvc asp.net-web-api

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

Apache Ignite.NET SQL不搜索非英文字符

使用Apache Ignite .NET 2.3.0尝试使用Linq扩展(Apache.Ignite.Linq)进行搜索.

组态:

     CacheConfiguration = new[]
     {
         new CacheConfiguration 
         {
             QueryEntities = new []
             {
                  new QueryEntity(typeof(string), typeof(SecuritiesItem))
                  {
                      Fields = new []
                      {
                          new QueryField { Name = "SearchString", FieldType = typeof(string)}
                      }
                  }
             }
         }
     }
Run Code Online (Sandbox Code Playgroud)

SecuritiesItem定义:

public class SecuritiesItem
{
    /* all other fields */

    public string ShortName { get; set; }
    public string SearchString { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

SearchString包含需要在搜索中使用的所有字段的合并数据.像这样:

Открытоеакционерноеобщество"Рогаикопыта"#☢#Systems Open Joint-Stock Company#☢#ОАО"РиК"#☢#Ssys#☢#335468321#☢#bner#☢#ОАО"РиК"#☢#Systems Open Joint-股份公司#☢#Открытоеакционерноеобщество"Рогаикопыта"#☢#Systems Open Joint-Stock Company#☢#RU003572593#☢#1-22-22222-A

像这样搜索:

_securitiesCache
    .AsCacheQueryable()
    .Where(s => …
Run Code Online (Sandbox Code Playgroud)

c# .net-core ignite

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

IgniteException:无法启动处理器:GridProcessorAdapter

使用Apache Ignite.Net 2.3.0

在测试服务器上部署应用程序 - Windows 2016

Ignite服务器无法启动.NET记录错误:

2018-01-31 14:37:32.7464|WARN|This operating system has been tested less rigorously: Windows Server 2016 10.0 amd64. Our team will appreciate the feedback if you experience any problems running ignite in this environment. 
2018-01-31 14:37:33.2150|WARN|Checkpoints are disabled (to enable configure any GridCheckpointSpi implementation) 
2018-01-31 14:37:33.2643|WARN|Collision resolution is disabled (all jobs will be activated upon arrival). 
2018-01-31 14:37:34.0801|WARN|Marshaller is automatically set to o.a.i.i.binary.BinaryMarshaller (other nodes must have the same marshaller type). 
2018-01-31 14:37:34.1706|ERROR|Exception during start processors, …
Run Code Online (Sandbox Code Playgroud)

c# ignite

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

此平台不支持Apache Ignite .NET序列化委托

这里提出关于安排工作的问题.

通过简单的文本输出到控制台测试它,并通过HttpClient通过简单的异步Web请求进行测试.工作良好.

实现了具有大量长时间运行任务和并行计算的实际业务逻辑.

Ignite .NET版本:2.3.0

应用平台:dotnet core 2.0

但是在服务注册时收到例外DeployClusterSingleton.

System.Runtime.Serialization.SerializationException:此平台不支持"序列化委托".

来源:System.Private.CoreLib

   at System.MulticastDelegate.GetObjectData(SerializationInfo info, StreamingContext context)
   at Apache.Ignite.Core.Impl.Binary.SerializableSerializer.WriteBinary[T](T obj, BinaryWriter writer)
   at Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write[T](T obj)
   at Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.WriteBinary[T](T obj, BinaryWriter writer)
   at Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write[T](T obj)
   at Apache.Ignite.Core.Impl.Binary.BinaryUtils.WriteArray(Array val, BinaryWriter ctx, Nullable`1 elemTypeId)
   at Apache.Ignite.Core.Impl.Binary.BinarySystemHandlers.WriteArray(BinaryWriter ctx, Object obj)
   at Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write[T](T obj)
   at Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.WriteBinary[T](T obj, BinaryWriter writer)
   at Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write[T](T obj)
   at Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.WriteBinary[T](T obj, BinaryWriter writer)
   at Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write[T](T obj)
   at Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.WriteBinary[T](T obj, BinaryWriter writer)
   at Apache.Ignite.Core.Impl.Binary.BinaryWriter.Write[T](T obj)
   at Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.WriteBinary[T](T obj, BinaryWriter writer) …
Run Code Online (Sandbox Code Playgroud)

.net-core ignite

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