首页 新闻 会员 周边

帮我看一下老外是如何回我的

0
悬赏园豆:5 [已解决问题] 解决于 2018-07-30 21:04

https://github.com/aspnet/Mvc/issues/7623  帮我看一下老外是如何回我的,我要怎么改我的代码,主要是并发大才会这样提示

代码我改过,但还是会出那问题

https://github.com/aspnet/Mvc/issues/7737

weisp的主页 weisp | 初学一级 | 园豆:3
提问于:2018-05-08 10:37
< >
分享
最佳答案
1

这是要找人翻译吗

这个问题产生原因是你自己使用方式引起的 跟其他无关 最后还给了一些建议

收获园豆:5
ycyzharry | 高人七级 |园豆:25651 | 2018-05-08 10:39
其他回答(3)
1

微软这人很有礼貌啊。

The issue is in your usage. This is not in any way related to this repo, so I'm going to close this. This question is actually a good candidate for Stackoverflow.
However, here are my couple of improvements you can make to your code:

there is no point in locking on a string or any other local variable.
Wrap the FileStream and StreamWriter lines with using blocks.
Having using block you won't need neither Flush nor Dispose explicitly.
These were generic comments. But a higher level one would be:

Do not open and close files on every log message - cache the instances and reuse existing handles. That'll reduce the load a lot.

这是他的回答,意思是让你多看看书,不要拿这种问题烦他们。

爱编程的大叔 | 园豆:30839 (高人七级) | 2018-05-08 11:01
0

lock一个本地变量是毫无意义的,另外可以考虑重用文件句柄,而不是每次都打开关闭文件。而且(他)建议不要到github上问这种简单问题。

Uteki | 园豆:573 (小虾三级) | 2018-05-08 19:25

@DotNet-fans: 那就忽略这句话,不影响理解

支持(0) 反对(0) Uteki | 园豆:573 (小虾三级) | 2018-05-09 10:31
0

转行吧,  干点别的.

DiggingDeeply | 园豆:338 (菜鸟二级) | 2018-07-31 11:09
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册