Tôi đang sử dụng log4net để ghi nhật ký. Cấu hình đăng nhập của tôi được lưu trữ trong một tệp riêng biệt.ngoại lệ cấu hình log4net
Web.Config: configSections
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
Xác định tập tin cấu hình của tôi trong AssemblyInfo.cs
[assembly: log4net.Config.XmlConfigurator(ConfigFile="Log4Net.config", Watch = true)]
Và khi tôi khởi LogManager của tôi, tôi nhận được lỗi này
"System.TypeLoadException"
message: Could not load type 'log4net.Config.Log4NetConfigurationSectionHlandler' from assembly 'Log4net'.
Có nó nói "Log4NetConfigurationSectionHlandler '", nó không phải là lỗi đánh máy
và sau đó, lỗi này
An error occurred creating the configuration section handler for log4net: Could not load type 'log4net.Config.Log4NetConfigurationSectionHlandler' from assembly 'Log4net'.
Edit: Cố gắng gợi ý Mauricio Scheffer của
có
log4net:ERROR XmlConfigurator: Failed to find configuration section 'log4net' in the application's .config file. Check your .config file for the <log4net> and <configSections> elements. The configuration section should look like: <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
trùng lặp: http://stackoverflow.com/questions/1321261/configuring-log4net-with-xml-file –
Chỉnh sửa: Tôi chỉ thấy rằng web.config của tôi đã có một loại "Log4NetConfigurationSectionHlandler" là từ web.config. Tôi vẫn đang thực hiện công việc này với một tệp cấu hình bên ngoài – ram