遇到沙雕问题:
1.HTTP could not register URL http://+:8000/HelloWCF/. Your process does not have access rights to this namespace.
解决方法:关闭VS,右击icon,用管理员打开
2.The remote server returned an error: (500) Internal Server Error.
解决方法:代码有问题,用 using (){}把原来的代码——WebServiceHost _serviceHost = new WebServiceHost(typeof(PersonInfoQueryServices), baseAddress)包起来就好了
3.It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail
解决方法:
1.装 StackExchange.Redis.Mono
2.验证一下,redis是否没开orz
4.超时原因可选尝试
https://blog.csdn.net/qq_35633131/article/details/84069184
5.为什么异步要比同步慢?
https://q.cnblogs.com/q/85001/
6.异步VS同步
https://blog.csdn.net/weixin_34077371/article/details/87092060
7.API 一直拿不到客户端发送的PUT中的josn信息,log中显示:
The application completed without reading the entire request body
解决方法:
查看一下自己发送信息时,body的格式对不对,比如Postman中,body的格式是否是application/json
![](https://img.haomeiwen.com/i1896143/68628b80fadd96aa.png)
8.Powershell 中,
获取Datatime:
$d = Get-Date
格式修改:
$time = (Get-Date).Tostring("yyyy:MM:dd")
9.以jobname为例,不想放入mango中,可以加上:
[BsonIgnore]
public string JobName { get; set; }
在反序列化时会因为缺少_id字段而无法成功反序列化对象
可以在class前面加上:
[BsonIgnoreExtraElements]
public partial class Job
{
...
}
10.action result 的扩展:
http://hamidmosalla.com/2017/03/29/asp-net-core-action-results-explained/
![](https://img.haomeiwen.com/i1896143/071d331efc13d340.png)
11.想要将某个属性可以被反序列化,但是不序列化,可以使用
public bool ShouldSerializeXX()
{
return false;
}
XX是属性名字,eg
如果不想序列化,也不想反序列化:
可以使用:
[JsonIgnore]
12 cannot find the MongoDB.Driver.Builders namespace
解决方法:
根据http://mongodb.github.io/mongo-csharp-driver/2.8/getting_started/installation/可以看到,
原因是缺少:MongoDB.Driver.Legacy.dll
NuGet install mongocsharpdriver
但是,文档中说:
mongocsharpdriver是从我们的1.x系列升级的兼容层。这不应该用于新项目。
所以不是很建议用Builders
网友评论