我一直在研究关于JWT和防伪标记,我发现这个文章从微软那里表明,在智威汤逊的防伪验证是没有必要的。
这是正确的还是我理解错了?
我正在使用 JWT 开发带有 webapi 和 angular 6 的应用程序
我想在项目包装器上使用Common.logging和log4net,我在我的日志项目中创建了一个log4net.config文件并配置了我的web.config文件,但是当我尝试记录任何内容时我得到了一个异常(错误,信息等) ).我认为问题出在web.config文件中,但我检查了,我没有看到任何错误.
异常错误是
为common/logging创建配置节处理程序时出错:无法创建类型'Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter,Common.Logging.Log4Net
DLL的
Common.Logging.2.0.0
Common.Logging.Log4Net.2.0.1
log4net.1.2.10
Run Code Online (Sandbox Code Playgroud)
包装类
using System;
using System.Diagnostics;
using Common.Logging;
using System.Reflection;
namespace LoggerL
{
public class Logger
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//static Logger()
//{
// XmlConfigurator.Configure();
//}
public static void Info(string msg = "")
{
var method = new StackFrame(1).GetMethod();
var name = method.DeclaringType.FullName + "." + method.Name + "(";
foreach (var item in method.GetParameters())
{
name += item.ParameterType.Name + " " + item.Name + ", ";
}
name = …Run Code Online (Sandbox Code Playgroud) 我在 C# 中有以下方法:
void Method1()
{
try
{
Method2();
}
catch(Method2Exception ex)
{
//Log error
}
}
void Method2()
{
if(error)
{
throw(new Method2Exception("error"));
}
//Do something and call method3
try
{
Method3();
}
catch(Method3Exception)
{
//??
}
}
void Method3()
{
//Do something
if(error)
{
throw(new Method3Exception("error"));
}
}
Run Code Online (Sandbox Code Playgroud)
Method3 它将被不同的方法调用,它返回 Method3Exception,我需要将异常从 Method2 重新抛出到 Method1,但我不想在 Method1 上捕获 Method3Exception。最好的方法是什么?
有什么建议