websocket
摘要:刚接触C#的时候了解过Socket编程,当时知道可以通过Socket通信实现即时通信,可是做出来类似于飞Q的小东西,但自从做了Web后端之后,对Socket编程渐渐遗忘,前端获取消息通常都是通过轮询的方式定期获取信息,但这种方式并不能达到即时的效果,也会存在大量的资源浪费,最近闲暇时分了解了一下We
阅读全文
posted @
2018-01-31 10:28
chester·chen
阅读(205)
推荐(0)
单元测试
摘要:近期要做一个数据同步,把一个数据库中的数据同步到另一个数据库,准备通过写单元测试方法的方式实现,之前使用过NUnit类库做单元测试,这次准备使用微软自己的单元测试项目来实现,因此查了一下,具体方式如下: 1.创建单元测试项目 2.将要测试(运行)的代码补全 3.运行测试 单元测试主要是通过断言(As
阅读全文
posted @
2018-01-30 09:06
chester·chen
阅读(130)
推荐(0)
C# 操作 MongoDB
摘要:今项目使用Mongodb,C#操作MongoDB使用MongoDB.Driver.dll库(Nuget),写了个小Demo,如下: 注:时间类型的属性,存入MongoDB后会比北京时间少8小时,是由于默认写入的是世界标准时间,可在时间类型属性上添加 [BsonDateTimeOptions(Kind
阅读全文
posted @
2018-01-29 16:33
chester·chen
阅读(591)
推荐(0)
vs 2017局域网内调试
摘要:之前调试代码都是在本地启动服务,以 localhost:端口号 的形式调试,今天发现也是可以用ip地址的形式来调用接口,这种方式可以支持内网内Client端调用接口,实现调试的功能,具体方法如下: 1.打开IIS Express的配置文件地址: 2.找到下面的节点,默认只有第一条,将第二条添加上 3
阅读全文
posted @
2018-01-25 13:21
chester·chen
阅读(2897)
推荐(2)
Http报头中不能添加中文字符
摘要:今逢一Bug,如下: 大意为:报头中有非法字符。故可将其编码后,set入Header,如下:
阅读全文
posted @
2018-01-23 13:37
chester·chen
阅读(1780)
推荐(0)
Task ContinueWith
摘要:前正无生意,且记Task.ContinueWith之用法。
阅读全文
posted @
2018-01-23 10:24
chester·chen
阅读(2177)
推荐(0)
Stopwatch运行时间 Parallel并行任务
摘要:using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading; using System.Threading.Tasks; n...
阅读全文
posted @
2018-01-23 10:10
chester·chen
阅读(194)
推荐(0)
Task async await
摘要:暇之余,究多Task、async、await。
阅读全文
posted @
2018-01-23 09:13
chester·chen
阅读(188)
推荐(0)
信号量
摘要:今逢SemaphoreSlim(信号量),似lock,记之。
阅读全文
posted @
2018-01-22 18:02
chester·chen
阅读(132)
推荐(0)
Expression表单式树
摘要:余于项目中逢Expression(表达式树),然今未明其用途也,记之以温。
阅读全文
posted @
2018-01-22 16:27
chester·chen
阅读(141)
推荐(0)
delegate Func Action Expression
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; namespace ConsoleApp3 { static class Program { delegate string delagateA(string para...
阅读全文
posted @
2018-01-22 16:02
chester·chen
阅读(165)
推荐(0)
常用技术
摘要:https://www.cnblogs.com/ldybyz/p/6961669.html Http访问: Unirest for .Net 分布式缓存框架: Microsoft Velocity:微软自家分布式缓存服务框架。 Memcahed:一套分布式的高速缓存系统,目前被许多网站使用以提升网站
阅读全文
posted @
2018-01-22 13:40
chester·chen
阅读(415)
推荐(0)