Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在ASP.NET MVC中使用C#推送通知_C#_Asp.net Mvc_Firebase_Push Notification - Fatal编程技术网

在ASP.NET MVC中使用C#推送通知

在ASP.NET MVC中使用C#推送通知,c#,asp.net-mvc,firebase,push-notification,C#,Asp.net Mvc,Firebase,Push Notification,在ASP.NET MVC中使用C#发送推送通知时,我面临一个严重问题。我将代码放入Global.asax文件中,每5分钟执行一次 我的代码在localhost上运行良好,但当我上传到生产服务器时,它不起作用 我得到这个错误: System.Net.WebException:基础连接已关闭:发送时发生意外错误 System.IO.IOException:无法从传输连接读取数据:远程主机强制关闭了现有连接 System.Net.Sockets.SocketException:远程主机强制关闭了现有连

在ASP.NET MVC中使用C#发送推送通知时,我面临一个严重问题。我将代码放入
Global.asax
文件中,每5分钟执行一次

我的代码在localhost上运行良好,但当我上传到生产服务器时,它不起作用

我得到这个错误:

System.Net.WebException:基础连接已关闭:发送时发生意外错误

System.IO.IOException:无法从传输连接读取数据:远程主机强制关闭了现有连接

System.Net.Sockets.SocketException:远程主机强制关闭了现有连接

位于System.Net.Sockets.NetworkStream.Read(字节[]缓冲区,Int32偏移量,Int32大小)
---内部异常堆栈跟踪结束---
位于System.Net.Sockets.NetworkStream.Read(字节[]缓冲区,Int32偏移量,Int32大小)
位于System.Net.FixedSizeReader.ReadPacket(字节[]缓冲区,Int32偏移量,Int32计数)
位于System.Net.Security.SslState.StartReceiveBlob(字节[]缓冲区,AsyncProtocolRequest asyncRequest) 在System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken消息,AsyncProtocolRequest asyncRequest) 位于System.Net.Security.SslState.ForceAuthentication(布尔值receiveFirst,字节[]缓冲区,AsyncProtocolRequest asyncRequest) 在System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult-lazyResult)上 位于System.Threading.ExecutionContext.RunInternal(ExecutionContext ExecutionContext、ContextCallback回调、对象状态、布尔值preserveSyncCtx) 在System.Threading.ExecutionContext.Run(ExecutionContext ExecutionContext,ContextCallback回调,对象状态,布尔保存SyncCTX) 在System.Threading.ExecutionContext.Run(ExecutionContext ExecutionContext,ContextCallback回调,对象状态) 在System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult)上 在System.Net.TlsStream.Write(字节[]缓冲区,Int32偏移量,Int32大小) 在System.Net.ConnectStrea
中,在此处输入代码
m.WriteHeaders(布尔异步)


请帮助我,因为我不了解实际问题是什么,我的代码在本地主机上运行良好。

ServicePointManager.SecurityProtocol=SecurityProtocolType.Tls12
添加到Global.asax代码的开头。我添加了此代码,但得到了如下相同的错误“错误2019-02-28 17:09:47500 45473ms WebAPI应用程序推送-System.Net.WebException:基础连接已关闭:发送时发生意外错误。-->System.IO.IOException:无法从传输连接读取数据:远程主机强制关闭了现有连接。-->System.Net.Sockets.SocketException:远程主机在stem.Net.Sockets.NetworkStream.Read(Byte[]buffer,Int32 offset,Int32 size)----内部异常堆栈跟踪的结束--几个月前,我在一个已运行数月的服务中遇到此错误。。问题在于Tls12证书,我使用的确切代码是:
ServicePointManager.SecurityProtocol=SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3在你做任何请求之前,你必须确保它在你放的任何地方都被调用。@Steve你救了我!我们使用的web推送通知已在所有浏览器上运行,但最近向Edge发送的通知将在服务器上失败,上面的错误表明webpush服务器(bn3p.notify.windows.com)关闭了连接。将其添加到Global.asax.cs修复了此问题。将
ServicePointManager.SecurityProtocol=SecurityProtocolType.Tls12
添加到Global.asax代码的开头。我添加了此代码,但得到了如下相同的错误“错误2019-02-28 17:09:47500 45473ms WebAPI应用程序推送-System.Net.WebException:基础连接已关闭:发送时发生意外错误。-->System.IO.IOException:无法从传输连接读取数据:远程主机强制关闭了现有连接。-->System.Net.Sockets.SocketException:远程主机在stem.Net.Sockets.NetworkStream.Read(Byte[]buffer,Int32 offset,Int32 size)----内部异常堆栈跟踪的结束--几个月前,我在一个已运行数月的服务中遇到此错误。。问题在于Tls12证书,我使用的确切代码是:
ServicePointManager.SecurityProtocol=SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3在你做任何请求之前,你必须确保它在你放的任何地方都被调用。@Steve你救了我!我们使用的web推送通知已在所有浏览器上运行,但最近向Edge发送的通知将在服务器上失败,上面的错误表明webpush服务器(bn3p.notify.windows.com)关闭了连接。将其添加到Global.asax.cs中修复了它。