https://github.com/aspnet/Mvc/issues/7623 帮我看一下老外是如何回我的,我要怎么改我的代码,主要是并发大才会这样提示
代码我改过,但还是会出那问题
https://github.com/aspnet/Mvc/issues/7737
这是要找人翻译吗
这个问题产生原因是你自己使用方式引起的 跟其他无关 最后还给了一些建议
微软这人很有礼貌啊。
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.
这是他的回答,意思是让你多看看书,不要拿这种问题烦他们。
lock一个本地变量是毫无意义的,另外可以考虑重用文件句柄,而不是每次都打开关闭文件。而且(他)建议不要到github上问这种简单问题。
@DotNet-fans: 那就忽略这句话,不影响理解
转行吧, 干点别的.